Thanks John....I didn't think of that....I've been working on this catalog admin interface for to long......my brain is mush.

John W. Holmes wrote:

From: "Tom Ray [Lists]" <[EMAIL PROTECTED]>



$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:



I assume you're fetching associative arrays from the result and $r['sku'] works, but you're not sure how to get the COUNT(*) value? Well, $r['COUNT(*)'] would work, but you could also use an alias:

SELECT sku, COUNT(*) AS mycount FROM orders GROUP BY sku

and then use $r['mycount'] to retrieve the value (after using
mysql_fetch_assoc/array, of course).

---John Holmes...



-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to