This is some really old code that I found somewhere so I know it's VERY sloppy but it works ... well ... almost
The bit that doesn't work is the part that loops through the number of votes for each option
Here's the code for that section
- PHP: Select all
<?
$show_votes = mysql_query("select * from pollq where pollq_id='$pollq_id'");
while($row_show_votes = mysql_fetch_array($show_votes)) {
for($j = 1; $j <= 10; $j++) {
if($row_show_votes['rep'.$j] != "") { ?>
<tr>
<td width="40" style="padding-left: 10px;" height="21"><? echo $row_show_votes['rep'.$j] . " <strong>[" . number_format(($answertally[$j-1] / $answertotal) * 100, 0, ".", '') . "%]</strong>" . " "; ?></td>
<td width="90" style="padding-left: 10px;" height="21" valign="middle"><img src="/i/line.jpg" width="<? echo ($answertally[$j-1] / $answertotal) * 50; ?>" height="10"></td>
</tr>
<? }
}?>
</table>
<p><strong><?=$answertotal; ?> votes</strong></p>
<? } ?>
And this is the part that doesn't work
- PHP: Select all
<? echo $row_show_votes['rep'.$j] . " <strong>[" . number_format(($answertally[$j-1] / $answertotal) * 100, 0, ".", '') . "%]</strong>" . " "; ?>
Actually ... the first bit
$row_show_votes['rep'.$j] works but the number_format things doesn't
Same with this part that doesn't work
- PHP: Select all
<img src="/i/line.jpg" width="<? echo ($answertally[$j-1] / $answertotal) * 50; ?>" height="10">