note 21139 deleted from function.mysql-num-rows by betz

From: Date: Sat, 10 Aug 2002 17:15:50 +0000
Subject: note 21139 deleted from function.mysql-num-rows by betz
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-34769@lists.php.net to get a copy of this message
darren@microcyb.com - the best way to resolve your problem would be to do this: $query = "SELECT count(subid) as count, subid FROM table GROUP BY subid"; $result = mysql_query($query); based on the following data this would return: id subid url urlname 1 2 yahoo.com yahoo 2 2 google.com google 3 1 myserver.com server 4 2 anotherserver.com server +-------+-------+ | count | subid | +-------+-------+ | 3 | 2 | | 1 | 1 | +-------+-------+ it's also a lot less database-intensive to do it this way - using COUNT() instead of mysql_num_rows.

« previous php.notes (#34769) next »