<?php
// first eshtablish your database connection.
$sql = mysql_query("select country, count(*) as cnt from created_form group by country order by count(*) desc;");
while($row = mysql_fetch_array($sql))
{
echo $row['country'];
echo $row['con'];
}
?>
in above query created_form is a table name and country is a field name of table created_form.
if your table data is like this
country
india
uk
uk
india
usa
india
usa
usa
than your out put will look like this.
country con
india 3
uk 2
usa 3
0 comments:
Post a Comment