query and count

From: Date: Wed, 09 Jan 2002 12:33:38 +0000
Subject: query and count
Groups: php.db 
Request: Send a blank email to php-db+get-15557@lists.php.net to get a copy of this message
I have two tables, the first one I query like : $query = "SELECT * FROM xp_topics WHERE artist_count='artist' AND topictext LIKE 'B%' ORDER BY artist_count DESC limit 0,5"; $req = mysql_query($query); $res = mysql_num_rows($req); if ($res == 0) { echo "</p> <p><b>Sorry there is no result.</b>";} else { while($row = mysql_fetch_array($req)) { extract($row); echo ("$topictext<br> "); } } The second one I want to do a count for each one that was returned above. eg Billie (2) , Bill (4) Bret (1)........ How would I set up the query to do both?

« previous php.db (#15557) next »