dareid5 Posted October 13, 2006 Share Posted October 13, 2006 I have a db that holds user entries in a poll. They select their favorite city. Doing so enters the city and state associated with that state.I would like to count each ‘vote’ for a city and list by state then show the highest rated cities.My problem right now is I’m not able to pull the data for the db and create an array that I can use to view it.Any help would be appreciated.Thanks,Dave Link to comment https://forums.phpfreaks.com/topic/23844-sort-and-count-array-from-mysql/ Share on other sites More sharing options...
craygo Posted October 13, 2006 Share Posted October 13, 2006 give us your field names so i can tweak the sql, but basically it would be like this[code]$sql = "SELECT count(city) AS citytotal, state from tablename group by state, city";[/code]Didn't test it but should be it.Ray Link to comment https://forums.phpfreaks.com/topic/23844-sort-and-count-array-from-mysql/#findComment-108305 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.