Re: [PHP] newbie php/mysql need help

2005-03-13 Thread Burhan Khalid
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

RE: [PHP] newbie php/mysql need help

2005-03-13 Thread Robbert van Andel
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