|
|
|
ขอวิธี ดึงข้อมูลจากฐานข้อมูลมาโชว์ ข้อมูลที่โชว์ได้ตอนนี้เป็น XML แต่อยากให้ดึงจากฐาน ข้อมูล ประมาณนี้ ครับ |
|
|
|
|
|
|
|
table size1
gen size date_ status
A 20 2012-11-01 1
A 10 2012-11-02 2
B 15 2012-12-01 0
B 5 2012-12-01 1
ไฟล์ SalesCompare.xml
Code (PHP)
<graph numdivlines='4' lineThickness='3' showValues='0' numVDivLines='10' formatNumberScale='1' rotateNames='1' decimalPrecision='1' anchorRadius='2' anchorBgAlpha='0' numberPrefix='$' divLineAlpha='30' showAlternateHGridColor='1' yAxisMinValue='800000' shadowAlpha='50' >
<?php
$strQuery = "select distinct(gen) as type_name , sum(size) as count_amt , date_ as Mydate , status from size1 WHERE status!=2 group by type_name";
$result2 = mysql_query($strQuery) or die(mysql_error());
//Iterate through each factory
if ($result2) {
while($ors2 = mysql_fetch_array($result2)) {
$ors2['type_name'];
$ors2['count_amt'];
}
}
?>
<categories >
<category Name='Jan' />
<category Name='Feb' />
<category Name='Mar' />
<category Name='Apr' />
<category Name='May' />
<category Name='Jun' />
<category Name='Jul' />
<category Name='Aug' />
<category Name='Sep' />
<category Name='Oct' />
<category Name='Nov' />
<category Name='Dec' />
</categories>
<dataset seriesName='Current Year' color='A66EDD' anchorBorderColor='A66EDD' anchorRadius='4'>
<set value='1127654' />
<set value='1226234' />
<set value='1299456' />
<set value='1311565' />
<set value='1324454' />
<set value='1357654' />
<set value='1296234' />
<set value='1359456' />
<set value='1391565' />
<set value='1414454' />
<set value='1671565' />
<set value='1534454' />
</dataset>
<dataset seriesName='Previous Year' color='F6BD0F' anchorBorderColor='F6BD0F' anchorRadius='4'>
<set value='927654' />
<set value='1126234' />
<set value='999456' />
<set value='1111565' />
<set value='1124454' />
<set value='1257654' />
<set value='1196234' />
<set value='1259456' />
<set value='1191565' />
<set value='1214454' />
<set value='1371565' />
<set value='1434454' />
</dataset>
</graph>
ไฟล์ index.php
Code (PHP)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>FusionCharts graph</title>
<link rel="stylesheet" href="style.css">
<script language="javascript" src="Charts/FusionCharts.js"></script>
<style type="text/css">
.sss {
text-align: center;
}
</style>
</head>
<body topmargin="20" leftmargin="0">
<table width="50%" border="0" align="center" cellpadding="1" cellspacing="1" class="sss">
<tr>
<td align='left' valign="middle" bgcolor="#FFFFFF">Model Graph</td>
</tr>
<tr>
<td align="center" class="table"><div id="chart5Div">This text is replaced by chart.</div>
<script type="text/javascript">
var chart2 = new FusionCharts("Charts/FCF_MSLine.swf", "ChId1", "750", "400");
chart2.setDataURL("Data/SalesCompare.xml");
chart2.render("chart5Div");
</script></td>
</tr>
</table>
<CENTER>
</CENTER>
</body>
</html>
Tag : PHP, JavaScript, VBScript, Action Script, Ajax, jQuery
|
|
|
|
|
|
Date :
2013-12-03 16:47:34 |
By :
Aun |
View :
804 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ผลการรัน ไฟล์ XML ที่ไม่มีโค๊ด PHP
|
|
|
|
|
Date :
2013-12-03 16:51:33 |
By :
Aun |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 01
|