topical media & game development
server-php-sqlite-voting-sql.php / php
<?php
//header ("Content-type: image/png");
red = imagecolorallocate (black = imagecolorallocate (
connect(s) / query (votes)
mysql_connect("localhost", "root", "hush");
mysql_query("USE local");
optionsquery = mysql_query("SELECT * FROM voteoptions");
optionsquery);
numvotes = mysql_num_rows(
setup display(s)
xval = 30;
numoptions);
for (i<=(i++)
{
optionsquery,votevalue = mysql_result(i,'value');
// echo votevalue.'<br />';
votevalue'");
currentnumquery);
rper = floor((currentnum/numvotes)*100);
imagefilledrectangle (xval, (200-xval+red);
imagerectangle (xval, (200-xval+black);
imagestring (xval+(voteoption, im, 2, (barwidth/2)), ((200-rper%", xval+=(
create(s) image
imagepng(im,'voting-plot.png');
?>
<center>
<img src=voting-plot.png width=100% height=100%>
</center>
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.