i am banging head now for hours. coz the query not fetching the ‘status’ column data
$query = $db->prepare("SELECT *
FROM users
WHERE username=:username
AND password=:password");
$query->execute(array(':username' => $username,
':password' => $password));
$row_count = $query->fetchColumn();
if ($row_count < 1){
echo "Sorry. Username and Password does not match. Please try again." ;
exit;
}
//check weather account is active//
$row = $query->fetch();
echo $row['status']; //here status returnes blank while it has the value 1.
Thanks Dormilich,
i just modified the code and it works now.
//check user name and password//
$query = $db->prepare("SELECT COUNT(username)
FROM users
WHERE username=:username
AND password=:password");
$query->execute(array(':username' => $username,
':password' => $password));
$row_count = $query->fetchColumn();
if ($row_count < 1){
echo "Sorry. Username and Password does not match. Please try again." ;
exit;
}
//Featch Data
$query = $db->prepare("SELECT *
FROM users
WHERE username=:username
AND password=:password");
$query->execute(array(':username' => $username,
':password' => $password));
//check weather account is active//
$row = $query->fetch();
$status=$row['status'];
echo $status;