Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
chart_from_mysql.php in the root of your web application.<?php
include("/Includes/FusionCharts.php");
include("/Includes/DBConn.php");
?>
<html>
<head>
<title>FusionCharts XT - Plotting data from MySQL</title>
<script src="Charts/FusionCharts.js"></script>
</head>
<body>
<center>
<?php
// Connect to the Database
$link = connectToDB();
// Fetch all total revenue of the last 3 years using SQL Query
$strQuery = "SELECT SUM( order_amount ) AS SUM, YEAR( order_date ) AS YEAR FROM orders GROUP BY YEAR ( order_date )";
$result = mysql_query($strQuery) or die(mysql_error());
$strXML = "<chart caption='Annual Revenue - last 3 years' numberPrefix='$'>";
while($row = mysql_fetch_array($result, MYSQL_BOTH)) {
$strXML .= "<set label = '".$row['YEAR']."' value = '".$row['SUM']."' />";
}
$strXML .= "</chart>";....