require_once "../all-cfg.php";
$dbh = mymysql_connect();
require_once "/home/webadmin/fishing-mania.com/lib/func.php";
$poll = 1;
include "../header.inc";
function width( $votes, $total )
{
$res = ceil((300 * ($votes / $total)));
return $res;
}
$poll_id = $_REQUEST['poll_id'];
settype($poll_id, "int");
//echo $_GET['mess'];
$sS = "SELECT sum(broi) AS total FROM poll_answears WHERE poll_id = ".$poll_id."";
$res = mysql_query( $sS );
$r = mysql_fetch_assoc($res);
//echo $sS;
$sSQL = "SELECT p.title, p.date, a.answear, a.broi
FROM poll_poll p
LEFT JOIN poll_answears a ON a.poll_id = p.id
WHERE p.id = ".$poll_id."";
$result = mysql_query( $sSQL );
echo '
';
$i = 1;
$total = array();
while($row = mysql_fetch_assoc($result)){
if( $i == 1 ){
echo '
'.$row['title'].' |
';
}
echo '
'.$row['answear'].' | '.(($row['broi'] > 0)?' '.(ceil(($row['broi'] / $r['total']) * 100)).'%':'0%').' |
';
$total[] = $row['broi']++;
$i++;
}
echo '
| Общо гласували: '.array_sum($total).' |
';
include "../footer.inc";
?>