topical media & game development
graphic-php-voting-db.php / php
<?php
see sql -- tutorial(s)
//header ("Content-type: image/png");
red = imagecolorallocate (black = imagecolorallocate (optionsquery = mysql_query("SELECT * FROM voteoptions");
optionsquery);
numvotes = mysql_num_rows(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+=(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.