$result = mysql_query("SELECT elevation FROM lakedata");
if (!$result) die('Could not query:' . mysql_error());
//$array;
$i=0;
while($row = mysql_fetch_array($result))
{
$array[] = $row[$i];
$i++;
}
echo $array[1];
// set up image
$height = 800;
$width = 1000;
$im = imagecreatetruecolor($width, $height);
$white = imagecolorallocate ($im, 255, 255, 255);
$blue = imagecolorallocate ($im, 0, 0, 255);
$red = imagecolorallocate ($im, 64, 0, 0);
// draw on image
imagefill($im, 0, 0, $blue);
// y-axis
imageline($im, 100, 0, 100, $height-100, $white);
// x-axis
imageline($im, 100, $height-100, $width, $height-100, $white);
imageline($im, 125, $array[0]*.5, 325, $array[0]*.5, $white);
imageline($im, 325, $array[0]*.5, 325, $array[0]*.5, $red);
imagestring($im, 4, 50, 150, 'Sales', $white);
// output image
Header ('Content-type: image/png');
imagepng ($im);
//clean up
imagedestroy($im);
mysql_close($con);