Sign in to follow this  
bassamj

help

Recommended Posts

 

 

 

 

 

 

<?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

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 by Guest

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