because you're supplying it with a string not the result of the query..
uncomment your line that says:
$result = mysql_query($query, $db);
and change the num rows line to:
else if (mysql_num_rows($result)==1)
Your line that gets the column results will fail for the same reason, give it
the result of the query, not the query itself.
-Micah
On Wednesday 03 March 2004 11:50 am, Craig Hoffman wrote:
> 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: [EMAIL PROTECTED] \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: [EMAIL PROTECTED]
> w: www.eclimb.net
> _________________________________
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php