I have multiple queries. How do I display these graphs on the same page from these queries. Currently, it only display one i.e Caption Question 2 graph instead of even the first i.e. Caption Question 1 graph. When I remove the code to display graph two i.e. Question 2 , then graph Caption Question 1 display. Any help please. See below code
<?php
//Generate the chart element string
$strXML = "";
//Now, we get the data for the first question
$sql = "SELECT ps_allanswers.answer as Answer, count(ps_answer.answer) AS Total FROM ps_allanswers LEFT OUTER JOIN ps_answer ON ps_answer.answer = ps_allanswers.answercode WHERE ps_allanswers.questionid = '1' GROUP BY ps_allanswers.answer, ps_allanswers.answercode ORDER BY ps_allanswers.answercode";
$result = $db->exec_sql($sql);
//Iterate through each factory
if ($result) {
while($ors = $db->fetch_assoc($result)) {
//Here, we convert date into a more readable form for set label.
$strXML .= "";
}
}
//Close element
$strXML .= "";
//Create the chart - Column 2D Chart with data from strXML
echo renderChart("FusionCharts/Column3D.swf", "", $strXML, "OuestionA", 300, 300, false, false);
?><?php
//Generate the chart element string
$strXML2 = "";
//Now, we get the data for the first question
$sql2 = "SELECT ps_allanswers.answer as Answer2, count(ps_answer.answer) AS Total2 FROM ps_allanswers LEFT OUTER JOIN ps_answer ON ps_answer.answer = ps_allanswers.answercode WHERE ps_allanswers.questionid = '2' GROUP BY ps_allanswers.answer, ps_allanswers.answercode ORDER BY ps_allanswers.answercode";
$result2 = $db->exec_sql($sql2);
//Iterate through each factory
if ($result2) {
while($ques2 = $db->fetch_assoc($result2)) {
//Here, we convert date into a more readable form for set label.
$strXML2 .= "";
}
}
//mysql_close($link);
//Close element
$strXML2 .= "";
//Create the chart - Column 2D Chart with data from strXML
echo renderChart("FusionCharts/Column3D.swf", "", $strXML2, "OuestionA", 300, 300, false, false);
?>