bassamj Report post Posted July 1, 2008 <?php //In this example, we show how to connect FusionCharts to a database. //For the sake of ease, we've used an MySQL databases containing two //tables. // Connect to the DB $link = connectToDB(); $strCategories = ""; $strDataCurr = ""; $strDataPrev = ""; $strDataPc = ""; //$strXML will be used to store the entire XML document generated //Generate the chart element $strXML = ""; // Fetch all factory records $strQuery = "select * from form_results"; $result = mysql_query($strQuery) or die(mysql_error()); //Iterate through each factory if ($result) { while($ors = mysql_fetch_array($result)) { $strCategories .= ""; $strDataCurr .= ""; $strDataPrev .= ""; $strDataPc .= ""; } } mysql_close($link); $strCategories .= ""; $strDataCurr .= ""; $strDataPrev .= ""; $strDataPc .= ""; $strXML .= $strCategories . $strDataCurr . $strDataPrev . $strDataPc . ""; echo renderChart("../../FusionCharts/MSColumn3D.swf", "", $strXML, "productSales", 600, 300, false, false); ?> Delete Last Entry Share this post Link to post Share on other sites
Arindam Report post Posted July 2, 2008 (edited) Please use Month wise SQL group by for this select month(Date) as mm, sum(pa) as pa, sum(pb) as pb, sum(pc) as pc from form_results group by month(Date) Edited July 2, 2008 by Guest Share this post Link to post Share on other sites
bassamj Report post Posted July 2, 2008 Thank you very much, you were very helpful. Bassam Share this post Link to post Share on other sites