At 13:00 18-06-02 +0100, Mark Colvin wrote:
>The function below works when I pass in a valid username and password and
>returns '1'. When I pass a username and password that is not in the database
>it still returns '1'. I have put some echo statements in for debugging and
>the value of $numresult is always '1'. Does mysql_num_rows retain results in
>memory or something like that or am I completely going down the wrong road?

that's because when 'select count(*)' = 0 when it finds no results.
So you get a record returned to $result with a single line that tells
you count(*) was 0.

what you should probably do is instead of counting, check for a valid
username/password returned by your query.  if they're blank, then
$user/$pass are either incorrect or not in your users table.

or, as someone else suggested, check the value of count(*)
rather than the number of lines returned by the query.

Eugene

--
---------------------------------------------------------------------
Eugene Mah, M.Sc., DABR               [EMAIL PROTECTED]
Medical Physicist/Misplaced Canuck    [EMAIL PROTECTED]
Department of Radiology               "For I am a Bear of Very Little
Medical University of South Carolina   Brain, and long words Bother
Charleston, South Carolina             me."   Winnie the Pooh
http://home.netcom.com/~eugenem/
PGP KeyID = 0x1F9779FD, 0x319393F4
PGP keys available on request         ICQ 3113529                 O-
---------------------------------------------------------------------


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to