Hi everyone.
I'm using PHPlot to draw graphs. Hopefully you are familiar with PHPlot. If not, here is a sample:
PHP Code:
$plot = new PHPlot();
$data = array(
array('', 1800, 5), array('', 1810, 7), array('', 1820, 10),
array('', 1830, 13), array('', 1840, 17), array('', 1850, 23),
array('', 1860, 31), array('', 1870, 39), array('', 1880, 50),
array('', 1890, 63), array('', 1900, 76), array('', 1910, 92),
array('', 1920, 106), array('', 1930, 123), array('', 1940, 132),
array('', 1950, 151), array('', 1960, 179), array('', 1970, 203),
array('', 1980, 227), array('', 1990, 249), array('', 2000, 281),
);
$plot->SetDataValues($data);
$plot->SetDataType('data-data');
$plot->DrawGraph();
So, as you can see, the data used by the plotter is an array of arrays.
Now, my data I want to use for this is in a database, that I access through SQL.
Here's what I have so far:
PHP Code:
while($row = mysql_fetch_array($sql))
{
$count = $count + 1;
$Date = $row['Date'];
$Mark = $row['Mark'];
$blah = array('', $Date, $Mark);
$graphdata[$count] = $blah;
};
$data = array($graphdata); //This bit is obviously instead of the example given above.
However, this doesn't seem to work and the graph image just returns the "corrupt image" X icon.
Can anyone spot what is wrong with my code or the right way to do it, please?
Thanks in advance.
Andy