Re: mysql_num_rows

From: Date: Wed, 03 Mar 2004 20:33:32 +0000
Subject: Re: mysql_num_rows
References: 1 2  Groups: php.db 
Request: Send a blank email to php-db+get-33270@lists.php.net to get a copy of this message
ok, I uncommented the line and changed a few things around. However I am still getting errors. I really do appreciate everyone's help. Thanks CH Here is the 'new' code: function notify_password($username, $password) // notify the user that their password has been changed { $query ="SELECT username FROM users WHERE username=('$username')"; => line 65 $result = mysql_query($query, $db);
    if (!$query)
    {
      return false;  // not changed
    }
=> line 70 else if (mysql_num_rows($result)==1)
      $user_id = mysql_result($result, 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;
    }
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /Users/choffman/Sites/www/cyclistsedge/include/forgot_password_functions.php on line 65 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 Your new password has been sent to your email address. __________________________________ Craig Hoffman - eClimb Media v: (847) 644 - 8914 f: (847) 866 - 1946 e: choffman@eclimb.net w: www.eclimb.net _________________________________ On Mar 3, 2004, at 2:17 PM, Daniel Clark wrote:
     $query ="SELECT username FROM users WHERE username=('$username')";
    // $result = mysql_query($query, $db);
Above line should be uncommented.
     if (!$query)
And the "if" checking the number of rows returned from the $result set. --PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.db (#33270) next »