COUNT(*) Output Question
| From: | Tom Ray [Lists] | Date: | Mon, 02 Aug 2004 20:19:48 +0000 |
| Subject: | COUNT(*) Output Question | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-192490@lists.php.net to get a copy of this message | ||
Hey-
I'm query my mySQL database to see how many of each Sku has been ordered. I am doing my query as:
$count=mysql_query("SELECT sku, COUNT(*) FROM orders GROUP BY sku");
But my question is how do I use PHP to output the COUNT(*) results? When I run the command when I'm logged into mySQL I get the following:
mysql> select sku, count(*) from orders group by sku\g
+----------+----------+
| sku | count(*) |+----------+----------+
| 10001 | 1 | | 10001a | 1 | | 10003 | 2 | | 10005 | 1 | | 10011 | 1 |+----------+----------+ I just can't figure out a way to output that Count(*) column into something HTML friendly...any help or thoughts on this would be appreciated! TIA