Hey here is the SQL statement I am using
$sql = "SELECT number, COUNT(name) FROM people WHERE id='$id' GROUP BY number";
$result = mysql_query($sql);
while($row = mysql_fetch_array($result)){
$statarray['stat'.$i] = $row['COUNT(name)'];
$i++; }
The number column stores a 0, 1, 2 or a 3 against each name so the array comes back totalling how many names there are against each number.. which works fine.
The only problem is, if all the names have a number 1 stored against them, my array entry ‘stat0’ does not tell me how many 0s there are because it is replaced by the number of 1s (this is because there are no 0s in the array so the first output is 1s)..
How do I find out how many names have 0s 1s 2s and 3s in their number column including when there are none?.. thanks in advance.
Or if you have a permanent numbers table as per comments