mysql_num_rows
| From: | Craig Hoffman | Date: | Wed, 03 Mar 2004 19:50:25 +0000 |
| Subject: | mysql_num_rows | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-33266@lists.php.net to get a copy of this message | ||
Perhaps someone could look at this function and help me trouble shoot it? This function notifies the user of their new passwd.
I keep getting an error message on this page (see below). What's strange is the script seems to be working because i am getting an email with my new password. Here is the error message I am receiving:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /Users/choffman/Sites/www/cyclistsedge/include/forgot_password_functions.php on line 70
suggestions? Anything will be helpful. Much Thanks CH
function notify_password($username, $password)
// notify the user that their password has been changed
{
$query ="SELECT username FROM users WHERE username=('$username')";
// $result = mysql_query($query, $db);
if (!$query)
{
return false; // not changed
}
line 70 => else if (mysql_num_rows($query)==1)
$user_id = mysql_result($query, 0, 'user_id');
$from = "From: missy@cyclistsedge.com \r\n";
$mesg = "Your password has been changed to $password \r\n"
."You might want to change it next time you log in. \r\n";
if (mail($username, 'Cyclists Edge login information', $mesg, $from))
return true;
else
return false;
}
__________________________________
Craig Hoffman - eClimb Media
v: (847) 644 - 8914
f: (847) 866 - 1946
e: choffman@eclimb.net
w: www.eclimb.net
_________________________________