Once again, I bow to the superior knowledge of those on Edugeek!
Another PHP, MySQL problem; I'm trying to produce a Dataset to use within FusionCharts for a project I'm working on, from a query on a MySQL database. The query is sound, and gives the results I need based on various session variables, but it's this bit I'm struggling with...
The thing works to a point, the first part of the dataset gets created (ie. The Categories), but for some reason the second part (ie. the values) doesn't. I get the opening and closing dataset, but it just refuses to output anything. It seems that the fetch_array gets killed off while the first while bit.
$strXML = "<chart caption='Date Range Data from Sensor' showAnchors='0' showValues='0' showBorder='1' formatNumberScale='0' lineThickness='2' lineColor='0000FF' xAxisName='Date & Time' yAxisName='Sensor Reading' >";
//Use the SQL Statement created in MM
$query2 = $rsSensorDataRange; //call string query
$strCategories = "<categories>"; //create categories
while ($cat = mysql_fetch_array($query2, MYSQL_ASSOC))
$strCategories .= "<category label='" . $cat['TimeOfDay'] . "' />"; //display categories
$strCategories .= "</categories>";
$strValues = "<dataset seriesName='Sensor Value'>"; //create values
while ($vals = mysql_fetch_array($query2, MYSQL_ASSOC))
$strValues .= "<set value='" . $vals['Value'] . "' />"; //display values
$strValues .= "</dataset>";
//Close the Chart XML String
$strXML .= $strCategories . $strValues . "</chart>";
//Render the Chart
echo renderChart("FusionChartsXT/ZoomLine.swf", "", $strXML, "SensorReading", 790, 400, false, true);
I've been staring at this for hours trying to work out why it isn't working! Please help!