Hello, bradgrafelman. Thanks for your response. I removed the mysql_data_seek from the script and it stopped the endless looping. However, my results are now displayed like the attachment shows.
I have 4 question responses setup in my database.. so it's basically repeating the 4 responses 6 different times.
I've split up my poll script to display on the results for now. Below is new script coding.
<?php
$conn = mysql_connect("mysql.******.com", "******", "*****")
or die($msg_no_connect);
mysql_select_db("*******")
or die(mysql_error());
$showvotes = "SELECT * FROM pollQuestions pq, pollAnswers pa WHERE pq.id = pa.pollid AND pq.id = '1'";
$res = mysql_query($showvotes);
$answertally[0] = 0;
$answertally[1] = 0;
$answertally[2] = 0;
$answertally[3] = 0;
$answertally[4] = 0;
$answertally[5] = 0;
$answertally[6] = 0;
$answertally[7] = 0;
$answertally[8] = 0;
$answertally[9] = 0;
$answertotal = 0;
while($row = mysql_fetch_array($res))
{
switch($row["answer"])
{
case $row["answer1"]:
$answertally[0]++;
break;
case $row["answer2"]:
$answertally[1]++;
break;
case $row["answer3"]:
$answertally[2]++;
break;
case $row["answer4"]:
$answertally[3]++;
break;
case $row["answer5"]:
$answertally[4]++;
break;
case $row["answer6"]:
$answertally[5]++;
break;
case $row["answer7"]:
$answertally[6]++;
break;
case $row["answer8"]:
$answertally[7]++;
break;
case $row["answer9"]:
$answertally[8]++;
break;
case $row["answer10"]:
$answertally[9]++;
break;
}
// Get the total number of votes
for($i = 0; $i < sizeof($answertally); $i++)
$answertotal += $answertally[$i];;
for($i = 1; $i <= 10; $i++)
{
if($row["answer$i"] != "")
{?>
<tr>
<td bgcolor="#FFEFCE" style="padding-left:10" width="50%" colspan="1" height="21">
<?php echo $row["answer$i"] . " [" . number_format(($answertally[$i-1] / $answertotal) * 100, 0, ".", '') . "%]" . "<br>"; ?>
</td>
<td bgcolor="#FFEFCE" style="padding-left:10" width="45%" colspan="1" height="21">
<img src="images/line.gif" width="<?php echo ($answertally[$i-1] / $answertotal) * 100; ?>" height="5">
</td>
<td bgcolor="#FFEFCE" style="padding-left:10" width="5%" colspan="1" height="21"></td>
</tr>
<?php
}
}
}?>
</table>
What am I missing? Thanks again for any responses.