No, you should run the query to match username and password and if you get no result back then not a valid user or password.
//Check if user is logged in
function CheckUser($username, $password){
// first protect your login from hackers using sql injection attack
$u = mysql_real_escape_string($uersname);
$p = mysql_real_escape_string($password);
$query = sprint_f("SELECT * FROM users WHERE username = '%s' AND password = '%s'", $u, $p);
$send = mysql_query($query) or die('sorry, there was an error in your query');
// now check for the user, and check it is only 1 user
if ($send && (mysql_num_rows($send) === 1)) {
echo "User Confirmed";
}
}
Most of that is to protect yourself from hacking.
Since a login is username and password match then that is what you should query for. It is not a usefull idea to check the user exists and then find the password is wrong; the temptation is then to give a message like 'wrong password' which just confirms to a hacker that the username exists and they only have to find the password.