I'm using JPgraph for the first time and trying to get mysql query results into the array for code based on the example bargradsmallex4.php. I've tried various syntax but not overly familiar with the mysql_fetch_array() and can't get it to insert data into the array. Any help would be appreciated. The query has been tested and produces results so it is not the query itself.
$sql= mysql_query('SELECT agency,current,sum(current)
FROM table2 WHERE MATCH(agency) AGAINST("health" IN BOOLEAN MODE) GROUP BY agency ');
// We need some data
$datay = array();
while($row = mysql_fetch_array($sql))
$datay[] = array(
'current' => $row['sum(current)'],
);
// Setup the graph.
$graph = new Graph(400,300);
$graph->SetScale("textlin");
$graph->img->SetMargin(25,15,25,25);
$graph->title->Set('"GRAD_VER"');
$graph->title->SetColor('darkred');
// Setup font for axis
$graph->xaxis->SetFont(FF_FONT1);
$graph->yaxis->SetFont(FF_FONT1);
// Create the bar pot
$bplot = new BarPlot($datay);
$bplot->SetWidth(0.6);
// Setup color for gradient fill style
$bplot->SetFillGradient("navy","lightsteelblue",GRAD_VER);
// Set color for the frame of each bar
$bplot->SetColor("navy");
$graph->Add($bplot);
// Finally send the graph to the browser
$graph->Stroke();