imagecreatefrompngwas used. This stores the base image, "graphtemp.png", resource into $im, rather than just white. Here are the dimensions etc. for the picture, incase you decide to make one to follow along: it is 400x220, the y-axis is 25 pixels away from the left hand of the image and the x-axis is 200 pixels away from the top of the image, the y-axis is 184 pixels in height and the y-axis is 360 pixels in length. Keep these numbers in mind, as they will be used later in the calculations. Next, we allocate the colors to be used. Using black for the outline gives a good effect, and the inside color is you choice. I will use red in this example. So
$red = imagecolorallocate ($im, 255, 0, 0);
$black = imagecolorallocate ($im, 0, 0, 0);
mysql_connect("localhost", "user", "password");
$optionsquery = mysql_query("SELECT * FROM voteoptions");
$numoptions = mysql_num_rows($optionsquery);
$numoptions. Even though just be looking at the MySQL table we can tell that there are four options, this may change. Having this number loaded dynamically allows the coder to have a truly dynamic graph system. Now, we need to know how many people have voted. This is a number that can't be checked manually, not with any ease for that matter.