<?php $color = array('Red', 'Green', 'Blue', 'Orange', 'Magenta','Maroon','MediumAquaMarine','MediumPurple','MediumVioletRed','MintCream','MediumSpringGreen','MediumOrchid','MediumSeaGreen');?>
<?php if(count($result) > 0):?>
  <table border="0" cellpadding="10" cellspacing="0">
  <?php $i = 0; ?>
  <?php foreach ($result as $key=>$res):?>
  <?php if($total > 0): ?>
  <?php $percent = round($res['quantity']*100/$total,2); ?>
  <?php else: ?>
  <?php $percent = 0;?>
  <?php endif;?>
  <?php if($percent == 0):?>
  <?php $width = 1;?>
  <?php else: ?>
  <?php $width = $percent;?>
  <?php endif ?>
  <tbody><tr height="22" class="content">
  <td  bgcolor="#ffffff"><nobr><?php echo $res['name']; ?></nobr></td>
  <td bgcolor="#ffffff" width="100%">
      <table align="left" border="0" cellpadding="0" cellspacing="0" height="20"><tbody>
          <tr><td bgcolor="<?php echo $color[$i]?>" width="<?php echo $width ?>%">&nbsp;</td>
          <td>&nbsp;<?php echo $percent ?>%</td></tr>
      </tbody></table>
  </td>
  <td align="right" bgcolor="#ffffff"><nobr><?php echo $res['quantity'] ?> phiếu</nobr></td>
  </tr>
  <?php $i++ ?>
  <?php endforeach;?>
  <tr height="25"><td colspan="3" class="VoteShow" align="right" bgcolor="#ffffff">Tổng cộng:<?php echo $total?> phiếu</td></tr>
  </tbody>
  </table>
<?php endif;?>