My fourth day using PHP has proven to be the hardest. I have a MySQL db set up that stores members login credntials. On the Login.php page I have the following code:
[code=php]
try {
$stmt = $db->prepare(“SELECT * FROM members WHERE username = :uname AND password = :pwd1”);
$stmt->bindParam(‘:uname’, $uname, PDO::PARAM_STR);
$stmt->bindParam(‘:pwd1’, $pwd1, PDO::PARAM_STR,40);
$stmt->execute();
$user_id = $stmt->fetchColumn();
if($user_id == false) {
echo ‘Login Failed’;
}
else {
echo ‘You are now logged in’;
}
}
catch (PDOException $ex) {
echo ‘We are unable to process your request. Please try again later’;
}
$uname and $pwd1 are from the form, and what I’m entering is indeed in the db. But I never get any echoes telling me success or failure. All I get when I submit the login info is a blank page. Will someone tell me what I’m doing wrong? Just need a push in the right direction is all.
Many thanks,
Landslyde