Forum Moderators: coopster
I have a polling system storing votes for 50 polls.
I want to display the results to visitors, but I have stored them according to ID number in the results table. Their labels are stored in a different table.
I want to print:
Label (from polls)
Average rating (from polldata)
Total ratings (from polldata)
The two tables are linked by ID only.
The code below just prints the ID number and the average and total votes, and I don't know how to link up the labels from the polls table.
Any suggestions?
$query = "SELECT SUM(rating) AS total, AVG(rating) AS mean, id AS label
FROM polldata GROUP BY id";
$i = 0;
$ask = mysql_query($query) or die("Select Failed!");
while($row = mysql_fetch_array($ask))
{
echo "<p><strong>" . $row['label']. "</strong> ".$row['mean']." (".$row['total'].")<BR>";
}