i have some php problems regarding my php code
i create function that update database, for changing password. here's my syntax
function changePassword($username, $password, $salt){
$query = "UPDATE mt_user SET password = '". $password ."' , salt = '". $salt . "' WHERE username = '". $username ."'";
$result = mysql_query($query);
if ($result == false){
$num_rows = mysql_error();
} else {
$num_rows = mysql_num_rows($result);
}
mysql_close();
return $num_rows;
}
I try this function by create some script :
echo changePassword('user1','test','test_salt');
The database value is updated but, the function is showing some warnings
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in .....
What's wrong with the code? Because i don't see any errors.
Thank you.