Sign in to follow this  
veerugadde

need help with adding mysql data using php class.

Recommended Posts

Hello,

 

 

 

I am trying to add the chart data from mysql database using php class.But for particular case of data query,i was unable to figure out as how to add the data to chart.

 

 

 

for example: SELECT value1 as Totalmarks,value2 as English,value3 as Maths,value4 as Science FROM SchooData;

 

 

 

from the above sample query,i want to show the totalmarks alongwith marks from english,math and science subjects in a single charts.I tried to use addDataFromDatabase() but it's showing only one value.i also tried with addDatasetsFromDatabase() but was unable to figure out.

 

 

 

Can anyone please help me out with above problem?

 

 

 

Thanks,

 

veerendra

Share this post


Link to post
Share on other sites

The way I've tried doing this is using PHP to query the database, save the result, and use it to construct an XML string.

 

 

 

The documentation has a section that discusses "Plotting from Database"

 

 

 

Maria

Share this post


Link to post
Share on other sites

Hi veerugadde,

 
Could you please show us the results of your SQL query in tabular format, because it seems that it is returing more than one row. And if this is the case then chart will show the repeated numbers of data for all columns (Totalmarks, English, Maths, Science).
 
So you would need to change your sql query to get the desire result.
 
However, a solution would be like this:
 
....
....
.....
$ors = mysql_fetch_array($result)
$FC->addChartData($ors['value1 '],'label=Totalmarks');

$FC->addChartData($ors['value2'],'label=English');

$FC->addChartData($ors['value3 '],'label=Maths');

$FC->addChartData($ors['value4'],'label=Science');

$FC->renderChart();

....

..... 

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