Kyberia v1.0
[mirrors/Kyberia-bloodline.git] / boxiky / poll.php
CommitLineData
bc13d5d6
H
1<?php include("../header_db.php"); ?>
2
3<?php
4if (IsSet($poll) AND IsSet($option)) {
5$sqlcmd="update polls set responses=responses+1 where id_poll=$poll";
6$result=mysql_query($sqlcmd);
7$sqlcmd="update poll_options set number=number+1 where id_option=$option";
8$result=mysql_query($sqlcmd);
9}
10
11else {
12echo "<table><tr><td colspan=3 align=center>";
13$sqlcmd="select * from polls where active='yes' order by id_poll desc limit 1";
14$result=mysql_query($sqlcmd);
15$riadok=mysql_fetch_array($result);
16echo $riadok[question];
17$percent=$riadok[responses]/100;
18if (!$percent) $percent=1;
19echo "</td></tr>";
20$sqlcmd="select * from poll_options where id_poll='$riadok[id_poll]'";
21
22$result=mysql_query($sqlcmd);
23while ($riadok2=mysql_fetch_array($result)) {
24 (int) $count = (int) ($riadok2[number]/$percent);
25 echo "<tr><td><a href=$PHP_SELF?poll=$riadok[id_poll]&option=$riadok2[id_option]>$riadok2[text]</a></td><td><table width=$count bgcolor=green height=5><tr height=5><td height=5></tr></td></table></td><td>".$count."% </td></tr>";
26}
27echo "</table>";
28}
29mysql_close();
30?>
This page took 0.142387 seconds and 4 git commands to generate.