>From a quick glance, I noticed that you have commented out the code that does the actual query against the MySQL database. This is the line: // $result = mysql_query($query, $db); Without this statement, there is no query to the database. It should be: $result = mysql_query($query); //without specifying a database link, it will use the available one The $result variable will then hold a result identifier that should be used throughout your code from then on (i.e. any place you currently have $query). For example: mysql_num_rows($result) or mysql_result($result, 0, 'user_id'); --Nicole --------------------------- Nicole Swan Web Programming Specialist Carroll College CCIT (406)447-4310 -----Original Message----- From: Craig Hoffman [mailto:choffman@xxxxxxxxxxx] Sent: Wednesday, March 03, 2004 12:50 PM To: php-db@xxxxxxxxxxxxx Subject: Spam: mysql_num_rows 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@xxxxxxxxxxxxxxxx \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@xxxxxxxxxx w: www.eclimb.net _________________________________ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php