![]() |
| PHP/mysql query problem |
|
jamie
HostMySite Sales Rep
![]()
|
I'm coding a system for a web-based game that has different elections. I'm storing the election results in a table with four fields
election_id vote_id user_id result all four fields are integers. Election_id is needed because the table will hold the results for more than one election. Vote_id is an autonumber primary key. User_id is the id number of the user submitting the vote, and 'result' is the id of the person they voted for. I'm now trying to display an html display that shows the top three candidates ordered by the number of votes they each received. I tried something like this
But it's not quite right because I can't get the count and ordering right. I thought about subqueries but I don't see how that would help; pretty sure i need some php functions here but I'm not too familiar with php. Any help would be appreciated. |
||||||||||||||
|
|
|||||||||||||||
|
jamie
HostMySite Sales Rep
![]()
|
This was solved with a subquery - respond here if you want me to post the actual query.
|
||||||||||||
|
|
|||||||||||||
| PHP/mysql query problem |
|
||
|



