RE: [PHP] mysql_num_rows always returns 1?

From: Date: Tue, 18 Jun 2002 20:22:04 +0000
Subject: RE: [PHP] mysql_num_rows always returns 1?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-102783@lists.php.net to get a copy of this message
> $query = "select count(*) from users where " You are asking for a count() in your query. This will always give you one row returned with a count. If you really want to do this you should probably have: $query = "select count(*) as usercount from users where" Then you can do your tests based on the value of usercount. Alternately, you could do something like this: $query = "select * from user where" And then use mysql_num_rows() to see how many users you got. In this case, no matches will result in no rows returned. CYA, Dave

« previous php.general (#102783) next »