Jump to content

Archived

This topic is now archived and is closed to further replies.

dareid5

Sort and Count Array from MYSql

Recommended Posts

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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.