RE: [PHP] COUNT(*) Output Question
| From: | Brad Ciszewski | Date: | Mon, 02 Aug 2004 20:21:53 +0000 |
| Subject: | RE: [PHP] COUNT(*) Output Question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-192492@lists.php.net to get a copy of this message | ||
Wouldn't count(sku) work?
-----Original Message-----
From: Tom Ray [Lists] [mailto:lists@blazestudios.com]
Sent: Monday, August 02, 2004 3:20 PM
To: php-general@lists.php.net
Subject: [PHP] COUNT(*) Output Question
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
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php