Re: [PHP-DB] count from the results

2002-02-09 Thread olinux
USe the count() function in mysql. Like this: $query = "SELECT count(artist) as howmany FROM artist WHERE artist LIKE 'b%' GROUP BY artist ORDER BY artist ASC"; $result = mysql_query($query) or die("Select Failed!"); echo "Total Number Of Artists In \"B\":  "; echo mysql_num_rows($resul

Re: [PHP-DB] count from the results

2002-02-09 Thread Jason Wong
On Sunday 10 February 2002 00:55, Barry Rumsey wrote: > I have the following code: > $query = "SELECT * FROM artist WHERE artist LIKE 'b%' ORDER BY artist > ASC"; [snip] > What I would like to know is how do I do a count on each result > returned.e.g. Benny(4) , Bill(10) Try: $query = "SELECT

[PHP-DB] count from the results

2002-02-09 Thread Barry Rumsey
I have the following code: $query = "SELECT * FROM artist WHERE artist LIKE 'b%' ORDER BY artist ASC"; $result = mysql_query($query) or die("Select Failed!"); echo "Total Number Of Artists In \"B\":  "; echo mysql_num_rows($result); echo ""; if (mysql_num_rows($result)) { echo ""; echo "Artists";