I'm going through a vid tutorial on creating a user reg & login form in php and mysql.
The following script should echo 'exists' on the login.php form, however just shows a blank (indicating the user does not exist, when it does and s in fact the only username on the DB)
<?php
function user_exists($username) {
$username = sanitize($username);
$query = mysql_query("SELECT * FROM `users` WHERE `username` = '$username'");
return (mysql_result($query, 0) == 1) ? true : false;
}
?>
The login form portion of code goes as follows:
if (user_exists('andy') === true) {
echo 'exists';
}
die();
Am I missing some syntax or something obvious?? here is a link to the vid tutorial if it helps http://www.youtube.com/watch?v=Til3oVNlho4