I have this function:
function login($username, $password) {
$user_id = user_id_from_user_name($username);
$username = sanitize($username);
$password = md5($password);
return (mysql_result(mysql_query("SELECT COUNT('user_id') FROM 'users' WHERE
'username' = '$username' AND 'password' = '$password'"), 0) == 1) ? $user_id : false;
}
Which is the one that returns the correct result ( true
if the username and pass match)
but this one down, that I do not see diff no difference no longer works. Does anyone know what I'm doing wrong?
function login($username, $password) {
$user_id = user_id_from_user_name($username);
$query = mysql_query("SELECT COUNT('user_id') FROM 'users' WHERE 'username' = '$username' AND 'password' = '$password'");
$username = sanitize($username);
$password = md5($password);
return (mysql_result($query, 0) == 1) ? $user_id : false;
}