I've been trying to create simple registration mechanism but something went wrong.
I dont know how to take a row from my database and simply display it, ive been trying to do it for a while but im going crazy it just doesnt work.
Here i post my code and just in case all other files like connecting to database or posting the variables are working just fetching a row from database doesnt work.
Code: Select all
<?php
session_start();
if((isset($_POST['log'])) && (isset($_POST['pass'])))
{
if((!empty($_POST['log'])) && (!empty($_POST['pass'])))
{
require_once 'connect.php';
$login = $_POST['log'];
$password = $_POST['pass'];
//echo $login.' '.$password;
$q1 = $db->prepare("SELECT * FROM test_table WHERE 'login' = :login AND 'password' = :password");
$q1->bindParam(':login', $login);
$q1->bindParam(':password', $password);
$q1->execute();
$a1 = $q1->fetch(PDO::FETCH_ASSOC))
{
echo $a1['nick'];
echo $a1['login'];
echo $a1['password'];
}
}
else
{
header('Location: index.html');
}
}
else
{
header('Location: index.html');
}
if you could point out in witch places in code i made mistakes i will be truly grateful