maharg
Technical User
- Mar 21, 2002
- 184
Hi
I am trying to create data for a Google Graphs application, taking data from MySQL
For example, if my data contains 6 lines of values, I need to create my data for the graph as follows ...
['Time from Andy', Graph value, Down Time],
['Time from Andy', Graph value, Down Time],
['Time from Andy', Graph value, Down Time],
['Time from Andy', Graph value, Down Time],
['Time from Andy', Graph value, Down Time],
['Time from Andy', Graph value, Down Time]
The last line must have no terminating comma.
I started off with this code, before I realised that the last comma must be absent (Or IE* fails to render the graph)
You can see an example in
I am struggling to see how to eliminate the terminating comma from just the last output line, so that it won't goof out IE.
Any guidance would be much appreciated!
With best regards,
Graham
I am trying to create data for a Google Graphs application, taking data from MySQL
For example, if my data contains 6 lines of values, I need to create my data for the graph as follows ...
['Time from Andy', Graph value, Down Time],
['Time from Andy', Graph value, Down Time],
['Time from Andy', Graph value, Down Time],
['Time from Andy', Graph value, Down Time],
['Time from Andy', Graph value, Down Time],
['Time from Andy', Graph value, Down Time]
The last line must have no terminating comma.
I started off with this code, before I realised that the last comma must be absent (Or IE* fails to render the graph)
You can see an example in
Code:
while($row=mysql_fetch_array($result))
{
extract($row);
$time_label = $row['TimeFromAndy'];
$graph_value = $row['InstRate'];
$downtime_value = $row['DownTime'];
echo "['".$time_label."', ".$graph_value.", ".$downtime_value."],".PHP_EOL;
}
I am struggling to see how to eliminate the terminating comma from just the last output line, so that it won't goof out IE.
Any guidance would be much appreciated!
With best regards,
Graham