﻿<?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   / multiseries bar chart with php &amp; mysql database / 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>Tue, 02 Dec 2008 05:32:06 GMT</lastBuildDate><ttl>20</ttl><item><title>multiseries bar chart with php &amp; mysql database</title><link>http://www.fusioncharts.com/forum/Topic5824-43-1.aspx</link><description>Following is the php code that I am using. Following example gives the multiseries bar chart according to  selected start date &amp;amp; end date. But suppose I have given $start_date='2008-4-1' &amp;amp; $end_date = '2008-4-12'   then following example gives the output (means bar) only for few dates between $start_date &amp;amp; $end_date. But following queries runs fine in database &amp;amp; gives correct output. But bar chart does not gives all records of queries. Tell me the &lt;/P&gt;&lt;P&gt;solution?&lt;/P&gt;&lt;P&gt;$strXML = "&amp;lt;graph caption='Passport And Visa Sales' subcaption='(In Units)' xAxisName='Date' yAxisName = 'Quantity'  formatNumberScale='0' decimalPrecision='0'&amp;gt;"&lt;BR&gt;    &lt;BR&gt; &lt;BR&gt;   //To store categories - also flag to check whether category is&lt;BR&gt; //already generated&lt;BR&gt;   $catXMLDone = false;&lt;BR&gt; //Initialize XML elements&lt;BR&gt;   $strCat = "&amp;lt;categories&amp;gt;";&lt;BR&gt; &lt;BR&gt; //First we need to get product type id (categories) &lt;/P&gt;&lt;P&gt; $strSQL = "SELECT DISTINCT(p.product_type_id) as ids, pt.product_type_desc as description FROM products as p, product_type as pt WHERE p.product_type_id &amp;gt;2  AND p.product_type_id = pt.product_type_id ";&lt;/P&gt;&lt;P&gt;&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;BR&gt; &lt;BR&gt;   if ($result) &lt;BR&gt;   {&lt;BR&gt;        while($orsCat = mysql_fetch_array($result)) &lt;BR&gt;       {  &lt;BR&gt;      &lt;BR&gt;            //Add this category as dataset&lt;BR&gt;            $strDataXML .= "&amp;lt;dataset seriesName='".$orsCat['description']."' color='". getFCColor() ."'&amp;gt;";&lt;/P&gt;&lt;P&gt;    //Now, we get the data for that passport &amp;amp; visa counts&lt;BR&gt;      $strSQL = "SELECT SUM(Total) as output,  days FROM(SELECT COUNT(oi.product_id) as Total,  Day(o.order_complete) as days FROM order_items as oi, orders as o,products as p WHERE p.product_type_id = '".$orsCat['ids']."' AND p.product_id = oi.product_id AND o.order_complete &amp;gt;='$start_date' AND o.order_complete &amp;lt;='$end_date'  AND o.order_id = oi.order_id AND oi.status_id &amp;lt;='6' GROUP BY days ORDER BY Total) as chart GROUP BY days  ";&lt;BR&gt;       &lt;BR&gt;            $result2 = mysql_query($strSQL) or die(mysql_error());&lt;BR&gt;            while($ors = mysql_fetch_array($result2))&lt;BR&gt;          {&lt;BR&gt;   //Append &amp;lt;category label=''&amp;gt; if not already done&lt;BR&gt;                if (!$catXMLDone) &lt;/P&gt;&lt;P&gt;                 {&lt;BR&gt;                       $strCat .= "&amp;lt;category name='" .$ors['days']. "' /&amp;gt;";&lt;BR&gt;    &lt;BR&gt;                }&lt;BR&gt;                 //Append data&lt;BR&gt;                 $strDataXML .= "&amp;lt;set value='" . $ors['output'] . "' /&amp;gt;";&lt;BR&gt;          }&lt;BR&gt;            //Update flag that we've appended categories  &lt;BR&gt;           $catXMLDone = true;&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;   }&lt;BR&gt;   // mysql_close($link);&lt;/P&gt;&lt;P&gt;    //Close &amp;lt;/categories&amp;gt;&lt;BR&gt; $strCat .= "&amp;lt;/categories&amp;gt;";&lt;BR&gt; //Create full XML&lt;BR&gt; $strXML .= $strCat.$strDataXML;&lt;/P&gt;&lt;P&gt;    //Return&lt;BR&gt; //return $strXML;&lt;/P&gt;&lt;P&gt;    //Close &amp;lt;graph&amp;gt; element&lt;BR&gt;    $strXML .= "&amp;lt;/graph&amp;gt;";</description><pubDate>Tue, 22 Apr 2008 07:12:59 GMT</pubDate><dc:creator>maheshshinde9</dc:creator></item></channel></rss>