Jump to content

graphic bar display problem on table


corbeeresearch

Recommended Posts

Hi,

 

I'm trying to make a poll and while the poll is working, I used the table to control the length of the bar, unfortunately once the graphic bar gets too long, it lost alignment with the table.

 

Where did I get wrong? Or are there better solution than this?

 

echo "<table cellpadding='0' cellspacing='0' border='0' width='100%' >";

$i = 0;
while($noticia = mysql_fetch_array($rs)){
echo "<tr>
    <td width='5%' bgcolor='#F1F1F1'> <font size='1' face='Verdana' color='#000000'>$noticia[opt]</font></td>";
$width2=$noticia['no'] *10 ; /// change here the multiplicaiton factor //////////
$ct=($noticia[no]/$rt)*100;
$ct=sprintf ("%01.2f", $ct); // number formating 

echo "    <td width='20%' bgcolor='#F1F1F1'> <font size='1' face='Verdana' color='#000000'>($ct %)</font></td><td width='60%' align='left' bgcolor='#F1F1F1'> <img src='graph.jpg' height=10 width=$width2>";
echo "</td><td width='15%' align='right'>";
echo "<font size='1' face='Verdana' color='#000000'>".$total_opt[$i];
echo " votes";
echo "</font></td>";
echo  "</tr>";
echo "<tr>
    <td  bgcolor='#ffffff' colspan=2>"; 
echo "</td>";
echo "</tr>";
$i=$i+1;
}
echo "<tr><td></td><td></td><td><font size='1' face='Verdana' color='#000000'>Total Votes:</font></td><td align='right'>";
//count the total votes
$count = 'select count(ans_id) from plus_poll_ans';
$count = mysql_query($count);
$count = mysql_fetch_array($count);
$total_count = $count['count(ans_id)'];

echo "<font size='1' face='Verdana' color='#000000'>".$total_count." votes</font>";
echo "</td></tr>";
echo "</table>";
echo "</font>";

 

Thanks

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.