Header Ads

PHP, MySQL with jQuery Polling System - 02

(update_box.php)<?php
include("dbcon.php");
$result=mysql_query("select * from polling");

$row=mysql_fetch_array($result);
//$gettotal = mysql_num_rows($result);

$gettotal = $row['dislike'] + $row['liked'];

$dislike=$row['dislike'];

$like=$row['liked'];

$average=$row['average'];

$likes=($like*30)/$gettotal;
$average=($average*30)/$gettotal;
$dislikes=($dislike*30)/$gettotal;?>



<button type="button" class="totalstatsbutton" onclick=";return false;" >
<div class="bluebar" style="width:<?php echo $likes?>px"><?php
$result=mysql_query("select * from polling");
$row=mysql_fetch_array($result);
echo $row['liked'] ;
?></div>
<div class="greenBar" style="width:<?php echo $dislikes?>px"><?php
$result=mysql_query("select * from polling");
$row=mysql_fetch_array($result);
echo $row['dislike'] ;
?></div>
<div class="redbar" style="width:<?php echo $average?>px"><?php
$result=mysql_query("select * from polling");
$row=mysql_fetch_array($result);
echo $row['average'] ;
?></div>
</button>


No comments

Thank you very much for your ideas!