Sign in to follow this  
Rahul Kumar

PHP MySQL Multiseries Bar Chart

Recommended Posts

Hello, I am using free fusion charts and I have to create a multiseries Bar Chart.

 

 

 

Below the code I am using for multiseries bar chart

 

 

 

include("../Includes/GuidemeDBConnectivity.php");

 

include("../Includes/Functions.php");

 

//This page generates the XML data for the Pie Chart contained in GuidemePieChart.php.

 

 

 

//Connect to the DB

 

$link = connectToDB();

 

 

 

//$strXML will be used to store the entire XML document generated Generate the graph element

 

$strXML = "";

 

 

 

//To store categories - also flag to check whether category is already generated

 

$catXMLDone = false;

 

 

 

//Initialize element - necessary to generate a multi-series chart

 

$strCategories = "";

 

 

 

// Fetch all factory records

 

$strQuery = " Select t.id,t. name from tests t GROUP BY id, name LIMIT 10 ";

 

 

 

$result = mysql_query($strQuery) or die(mysql_error());

 

 

 

//To store datasets and sets

 

$strDataXML = "";

 

 

 

//Iterate through each factory

 

if ($result) {

 

while($ors = mysql_fetch_array($result)) {

 

 

 

$strDataXML .= "";

 

 

 

$strQuery = "SELECT ct.score, t.id, t.name, ct.users_LOGIN FROM tests AS t, completed_tests AS ct, directions AS d, lessons AS l, users AS u WHERE ct.tests_ID =". $orsCat['id'] ." AND d.id = l.directions_ID AND l.id = t.lessons_ID AND ct.users_LOGIN = u.login AND ct.status='completed' GROUP BY ct.users_LOGIN LIMIT 30";

 

 

 

//$strQuery = "select sum(Quantity) as TotOutput from Factory_Output where FactoryId=" . $ors['FactoryId'];

 

$result2 = mysql_query($strQuery) or die(mysql_error());

 

while($ors = mysql_fetch_array($result2)

 

{

 

if (!$catXMLDone) {

 

$strCategories .= "";

 

}

 

//Append data

 

$strDataXML .= "";

 

}

 

//Update flag that we've appended categories

 

$catXMLDone = true;

 

//Clear up objects

 

mysql_free_result($result2);

 

//Close dataset element

 

$strDataXML .= "";

 

}

 

}

 

mysql_close($link);

 

//Close

 

$strCategories .= "";

 

//Finally, close element

 

$strXML .= $strCategories . $strDataXML . "";

 

 

 

//Set Proper output content-type

 

header('Content-type: text/xml');

 

 

 

//Just write out the XML data

 

//NOTE THAT THIS PAGE DOESN'T CONTAIN ANY HTML TAG, WHATSOEVER

 

echo $strXML;

 

 

 

I using PHP and MySQL. Where am I wrong? Please help

 

No data to display it shows

 

 

 

Thanks in advance

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this