If you're using JPGraph and can't quite figure out why my_sql_fetch_array() doesn't work in place of array(), here's your solution.
The short version is that you have to read the data returned by my_sql_fetch_array() in to a new array().
Code: Select all
<?php
$sql = mysql_query(SELECT * from table);
While ($row = mysql_fetch_array($sql)) {
global $data, $label; //if you don't declare these globals, the new arrays will not be usable outside of this loop
$data[] = $row['balance'];
$label[] = $row['creditor_name'];
}
$graph = new PieGraph(400,400);
$p1->SetLegends($label);
?>