Hi, i am having problems getting the % of votes cast:
here is my code
I want the td width % to be the % of casts voted!
any ideas how to get the %?
Regards,
Martin
Gaming Help And Info:
here is my code
Code:
<?php
//get poll q
$qTitle = mysql_query("SELECT pollTitle FROM poll_questions WHERE poll_id = '$poll_id'") or die(mysql_error());
list($PollTitle) = mysql_fetch_row($qTitle);
?>
<table width="100%" border="0" cellspacing="0" cellpadding="1">
<tr>
<td bgcolor="#000000"> <table width="100%" border="0" cellspacing="0" cellpadding="10">
<tr>
<td bgcolor="1e477e"> <?php echo $PollTitle; ?> </td>
</tr>
</table></td>
</tr>
</table>
<br>
<table width="100%" border="0" cellspacing="3" cellpadding="1">
<?php
$qAns = mysql_query("SELECT optionText, optionCount, voteID FROM poll_answers WHERE poll_id = '$poll_id'") or die(mysql_error());
while(list($opT,$opC,$vID) = mysql_fetch_row($qAns)){
if($opT != ""){
$w = 100 - $opC;
$o = 100-$w;
?>
<tr>
<td width="100" align="right" nowrap><?php echo $opT; ?></td>
<td bgcolor="#000000">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="<?php echo $w; ?>%" background="../assets/images/pollBar.gif"><?php echo $opC; ?></td>
<td width="<?php echo $o; ?>%" bgcolor="#FF3300"></td>
</tr>
</table></td>
<?php
}//end if
}
?>
</table>
I want the td width % to be the % of casts voted!
any ideas how to get the %?
Regards,
Martin
Gaming Help And Info: