I have a table called avatars, it has id, series ... Now i want to count the number of avatars of each series.
I ran this code in mysql -> SELECT series, COUNT(*) as 'count' FROM avatars GROUP BY series LIMIT 0, 30
Then it showed me a table that has 2 columns (series and count), for example
series count
Nature 5
Celebrities 13
Now i want to display it on my page with php:
<?php
Something is wrong with the while part. Can you tell me how i should correct it??? Thanks.
I ran this code in mysql -> SELECT series, COUNT(*) as 'count' FROM avatars GROUP BY series LIMIT 0, 30
Then it showed me a table that has 2 columns (series and count), for example
series count
Nature 5
Celebrities 13
Now i want to display it on my page with php:
<?php
Code:
$sql = "SELECT series, COUNT(*) as 'count' FROM avatars GROUP BY series LIMIT 0, 30";
while ($result = mysql_fetch_array($sql)) {
echo "Name : ".$result[series]." returned ".$result[count]." rows";
}
?>
Something is wrong with the while part. Can you tell me how i should correct it??? Thanks.