Trying to create TOP 10 poll questions

admin

Administrator
Staff member
Any help will be GREATLY appreciated... Thank you in advance...

I am trying to form a query that will calculate the total votes for all my polls and then will sort the totals by the top 10.

Then I need to output something that will look like this:

Top 10 / total votes / poll question
1 300 Whats your favoriate color?
2 260 Whats your favoriate etc..?
3 180 Whats your favoriate etc..?
etc...

The poll database table (sympoll.list) consists of for example:

FIELDS: pollID / question
1 What is your usual FPS with no one around?
2 What is your usual FPS during?
3 Memory How much memory do you have in your computer?

The poll database table (sympoll.data) consists of for example:

FIELDS: POLLID / Choice ID / choice / votes
2 0 0.5 to 1 FPS 27
2 1 1 to 2 FPS 13
2 2 2 to 5 FPS 48
2 3 5 to 10 FPS 157
2 4 10 to 20 FPS 348
2 5 20 to 50 FPS 189
3 0 64mb 1
3 1 128mb 15
3 2 192mb 5
3 3 256mb 75
3 4 384mb 65
3 5 512mb 120
3 6 768mb 19
3 7 1 GB+ 9

Here is what I have so far (wrong),

$query = "select count(*) from sympoll_data.votes WHERE sympoll_data.pollid ORDER BY sympoll_data.pollid DESC LIMIT 10";
$result = mysql_db_query($db, $query, $connection)

$row_count = 1;

while
($totals = mysql_fetch_array($result)
{
$quest= $totals["question"];
$counts = $totals["votes"];
$pn = $totals["pollid"];

echo"
etc....
 
Back
Top