RE:[PHP] login problem fixed!!
| From: | Andy B | Date: | Thu, 25 Mar 2004 09:53:05 +0000 |
| Subject: | RE:[PHP] login problem fixed!! | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-181465@lists.php.net to get a copy of this message | ||
[snip]
please note this will only catch invalid queries. To catch the event
of the query being perfectly fine, but nothing coming back, just check
the values of num_rows or affected_rows (depending on the query).
[/snip]
um....?? this way doesnt work for some strange reason... testing
affected_rows returns always with 0 so: if(mysql_affected_rows()==0){...}
will always get ran even if the query itself returned an invalid user
login...
num_of_rows will always return true and never false i guess because when
$result (the query itself) is "invalid" or returns the fact that the user
typed a wrong username and or password the db server returns NULL, false or
rightfully 0. thus the error:
num_of_rows() is not a valid resource type in:......login.php error
so as far as i know i have to test the literall existance of the $result
resource being true (a real login) or false (the login failed)...
at this point i cant test for $_SESSION['username'] because it hasnt been
registered yet...
anyhow..off my soap box