﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>FusionCharts Forum / FusionCharts Free / FusionCharts Free and PHP   / problem with example that you have given in FusionCharts Blueprint Application - PHP + MySQL version / Latest Posts</title><generator>InstantForum.NET v4.1.4</generator><description>FusionCharts Forum</description><link>http://www.fusioncharts.com/forum/</link><webMaster>support@fusioncharts.com</webMaster><lastBuildDate>Mon, 06 Oct 2008 08:22:37 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: problem with example that you have given in FusionCharts Blueprint Application - PHP + MySQL version</title><link>http://www.fusioncharts.com/forum/Topic5930-43-1.aspx</link><description>Hi Mahesh, &lt;P&gt;Thanks for pointing this out. We modify the code in a different fashion up here. We get all available month names separately and also keep a track of the available months in an array for refrence while creating datasets. Note that now we order the SQL.&lt;/P&gt;&lt;P&gt;Could to please try the following code?&lt;/P&gt;&lt;P&gt;Here is the modified function :&lt;/P&gt;&lt;P&gt;//getCumulativeSalesByCatXML returns the cumulative sales for each category&lt;BR&gt;//in a given year&lt;BR&gt;function getCumulativeSalesByCatXML($intYear, $forDataURL) {&lt;/P&gt;&lt;P&gt;    // Function to connect to the DB&lt;BR&gt;    $link = connectToDB();&lt;/P&gt;&lt;P&gt;    //To store categories - also flag to check whether category is&lt;BR&gt; //already generated&lt;BR&gt; &lt;BR&gt; //Initialize XML elements&lt;BR&gt; //Categories&lt;BR&gt; $strCat = "&amp;lt;categories&amp;gt;";&lt;BR&gt; $arrCat =array();&lt;BR&gt; $strSQL = "SELECT  distinct Month(o.OrderDate) as MonthNum from FC_Orders as o WHERE year(o.OrderDate)=$intYear order by Month(o.OrderDate)";&lt;BR&gt;    $result = mysql_query($strSQL) or die(mysql_error());&lt;BR&gt;    if ($result) {&lt;BR&gt;  $mc=0;&lt;BR&gt;        while($orsCat = mysql_fetch_array($result)) {&lt;BR&gt;            //Add this category as dataset&lt;BR&gt;   $arrCat[$mc++]=date("n",mktime(0,0,0,$orsCat['MonthNum'],2,1994));&lt;BR&gt;   $strCat .= "&amp;lt;category label='" . date("F",mktime(0,0,0,$orsCat['MonthNum'],2,1994)) . "' /&amp;gt;";&lt;BR&gt;  }&lt;BR&gt;     mysql_free_result($result);&lt;BR&gt; &lt;BR&gt; }&lt;BR&gt; $strCat .= "&amp;lt;/categories&amp;gt;";&lt;BR&gt;  &lt;BR&gt; &lt;BR&gt; &lt;BR&gt; //First we need to get unique categories in the database&lt;BR&gt; $strSQL = "Select CategoryID,CategoryName from FC_Categories GROUP BY CategoryID,CategoryName";&lt;BR&gt;    $result = mysql_query($strSQL) or die(mysql_error());&lt;BR&gt;  &lt;BR&gt;    //To store datasets and sets&lt;BR&gt;    $strDataXML = "";&lt;/P&gt;&lt;P&gt;    if ($result) {&lt;BR&gt;        while($orsCat = mysql_fetch_array($result)) {&lt;BR&gt;            //Add this category as dataset&lt;BR&gt;            $strDataXML .= "&amp;lt;dataset seriesName='" . escapeXML($orsCat['CategoryName'],$forDataURL) . "'&amp;gt;";&lt;BR&gt;            //Now, we need to get monthly sales data for products in this category&lt;BR&gt;            $strSQL = "SELECT  Month(o.OrderDate) as MonthNum, g.CategoryID, g.CategoryName, ROUND(SUM(d.Quantity),0) as Quantity, SUM(d.Quantity*p.UnitPrice) As Total FROM FC_Categories as g,  FC_Products as p, FC_Orders as o, FC_OrderDetails as d  WHERE year(o.OrderDate)=" . $intYear ." and g.CategoryID=" . $orsCat['CategoryID'] . " and d.ProductID=p.ProductId and g.CategoryID= p.CategoryID and o.OrderID= d.OrderID GROUP BY g.CategoryID,g.CategoryName,Month(o.OrderDate) order by Month(o.OrderDate)";&lt;BR&gt;            //Execute it&lt;BR&gt;            $result2 = mysql_query($strSQL) or die(mysql_error());&lt;BR&gt;   $mc=0;&lt;BR&gt;            while($ors = mysql_fetch_array($result2)) {&lt;BR&gt;                //Append &amp;lt;category label=''&amp;gt; if not already done&lt;BR&gt;                //Generate the link&lt;BR&gt;                $strLink = urlencode("updateProductChart(" . $intYear . "," . $ors['MonthNum'] . "," . $ors['CategoryID'] . ");");&lt;/P&gt;&lt;P&gt;    while($arrCat[$mc++]&amp;lt;$ors["MonthNum"]){&lt;BR&gt;     $strDataXML .="&amp;lt;set/&amp;gt;";&lt;BR&gt;    }&lt;BR&gt;                $strDataXML .= "&amp;lt;set value='" . $ors['Total'] . "' link='" . $strLink . "'/&amp;gt;";&lt;BR&gt;            }&lt;BR&gt;            //Clear up objects&lt;BR&gt;            mysql_free_result($result2);&lt;BR&gt;            //Close dataset element&lt;BR&gt;            $strDataXML .= "&amp;lt;/dataset&amp;gt;";&lt;BR&gt;        }&lt;BR&gt;    }&lt;BR&gt;    mysql_close($link);&lt;/P&gt;&lt;P&gt; //Create full XML&lt;BR&gt; $strXML = $strCat . $strDataXML;&lt;/P&gt;&lt;P&gt;    //Return&lt;BR&gt; return $strXML;&lt;BR&gt;}&lt;BR&gt;</description><pubDate>Fri, 25 Apr 2008 13:09:17 GMT</pubDate><dc:creator>Sudipto Choudhury</dc:creator></item><item><title>problem with example that you have given in FusionCharts Blueprint Application - PHP + MySQL version</title><link>http://www.fusioncharts.com/forum/Topic5930-43-1.aspx</link><description> got some problem with example you have given free php &amp;amp; mysql sample.(FusionCharts Blueprint Application - PHP + MySQL version)&lt;P&gt;This error contains in sales by category page (i.e. multiseries example).(pages that contains data to show multiseries charts are Data_SalesByCategory.php,Default.php  &amp;amp; DataGen.php)&lt;/P&gt;&lt;P&gt;I have changed tables fc_orders, fc_orderdetails &amp;amp; fc_products as follows.&lt;/P&gt;&lt;P&gt;I have changed orderdate to 2/5/1994 for orderid 10249 in fc_orders table. In fc_orderdetails table  orderid 10249 contains two productid 14 &amp;amp; 51. In fc_products table , productid 14's category id is 7 &amp;amp; productid 51's category id is 7.&lt;/P&gt;&lt;P&gt;Means bar chart should show Feb(means second month) data. But it does not show that data.&lt;/P&gt;&lt;P&gt;Because you have set flag $catXMLDone for only first product 'Beverages'. Can you find the solution</description><pubDate>Fri, 25 Apr 2008 03:37:18 GMT</pubDate><dc:creator>maheshshinde9</dc:creator></item></channel></rss>