so here is the line calling the function:
$login = login($username, $password);
if($login == false)
{
$errors[] = 'That username/password combination is incorrect';
}else
{
$_SESSION[user_id] = $login;
header('Location: anounceEdit.php');
exit();
and here is the functions code
function login($username, $password)
{
$user_id = user_id_from_username($username);
$username = sanitize($username);
$password = SHA1($password);
$query = mysql_query("SELECT COUNT(user_id) FROM users WHERE userName = '$username' AND password = '$password'");
return(mysql_result($query, 0) === 1) ? $user_id : false;
}
and the function that it calls
function user_id_from_username($username)
{
$username = sanitize($username);
$query = mysql_query("SELECT user_id FROM users WHERE userName = '$username'");
return mysql_result($query, 0, 'user_id');
}
i know that i am entering the corect information i even went an redid it on the server end so that i could make sure and i am still getting:
Array ( [0] => That username/password combination is incorrect )
what am i missing here? been working on this login code for a week now so i definitely need a fresh pair of eyes