Re: mysql_num_rows

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I got it working!  Thanks everyone!
__________________________________
Craig Hoffman - eClimb Media

v: (847) 644 - 8914
f: (847) 866 - 1946
e: choffman@xxxxxxxxxx
w: www.eclimb.net
_________________________________
On Mar 3, 2004, at 2:46 PM, Micah Stevens wrote:


the $db variable isn't referencing a proper connection. As you did not create
the db connection in this function, I'm assuming it's a scope problem. Make
sure that $db is global, and then add a global statement to the first line in
the function for this variable.


the $db you're referencing in the query is not the same $db that you assigned
the connection parameter to. If you're a sloppy programmer like me, and you
only have 1 connection, you can eliminate it from the query statement if you
want.


-Micah

On Wednesday 03 March 2004 12:33 pm, Craig Hoffman wrote:
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@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;
     }


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@xxxxxxxxxx
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

-- 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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux