p80 wrote:
I do a mysql request like this one:
SELECT DISTINCT (brand), COUNT( brand )FROM `machines` where category like
'sold' group by brand"
Try adding aliases to your query, such as :
SELECT DISTINCT (brand), COUNT (brand) AS brand_count FROM `machines`
WHERE `category` LIKE 'sold' GROUP BY
Simple but should work.
$query = " SELECT DISTINCT (brand), COUNT( brand )FROM `machines` where
category like 'sold' group by brand;";
$result = mysql_query($query) or die(mysql_error());
While($data = mysql_fetch_array($result)) {
echo "{$data[0]} - {$data[1]}\n";
}
-Original Messa
2 matches
Mail list logo