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 Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.