<?
include_once ('phpMyGraph5.0.php'); // Link to library file phpMyGraph 5.0

     $cfg ['title'] = 'Rainfall over time from sensor 1 VerticalLineGraph'; 	//Configure, title, width and height
     $cfg ['width'] = 1000;		//number of pixels horizontally
     $cfg ['height'] = 900;		//number of pixels vertically

include "conninfo.php";  
$query="SELECT mydata,thedate FROM rainfalldata where sensor='1'";
$result=mysqli_query($link,$query);		//get data from database

$data=array();
$x=0;

while ($r=mysqli_fetch_array($result))
{
$data[$r["thedate"]]=$r["mydata"];			//put data into array

}

header ("Content-type: image/png"); 
$graph = new phpMyGraph();
$graph-> parseVerticalLineGraph ($data, $cfg); //create graph
?>