I have a MySQL database with a table that has a field/column labled "user8" (which is the field for users' state).
I have this PHP call and its working fine if I call all states individually and I only want numbers of rows.
<?PHP
mysql_select_db("freeskat_promail") or die(mysql_error());
$result = mysql_query("SELECT *
FROM `users`
WHERE `user8` LIKE '%Georgia%'
");
$num_rows = mysql_num_rows($result);
echo $num_rows - Georgia\n;
?>
I would like the MySQL call and the PHP to echo out the lists of all states by percentage.
i.e.
United States 50%
Candana 30%
etc.
This is what I have so far.
<?PHP
mysql_select_db("freeskat_promail") or die(mysql_error());
$result = mysql_query("SELECT user8, COUNT(*) AS Total, SUM(in) AS TotalIn, SUM(in)*100/COUNT(*) AS Percent FROM lm_users GROUP BY user8
");
$num_rows = mysql_num_rows($result);
echo $num_rows \n;
?>
It should work, but doesn't.
Any help would be appreciated.
Thanks