01.
<?php
02.
03.
04.
include
(
"../Includes/FusionCharts.php"
);
05.
include
(
"../Includes/DBConn.php"
);
06.
?>
07.
<HTML>
08.
<HEAD>
09.
<TITLE>
10.
สถิติจำแนกตามเพศ
11.
</TITLE>
12.
<?php
13.
14.
15.
16.
?>
17.
<SCRIPT LANGUAGE=
"Javascript"
SRC=
"../../FusionCharts/FusionCharts.js"
></SCRIPT>
18.
<style type=
"text/css"
>
19.
<!--
20.
body {
21.
font-family: Arial, Helvetica, sans-serif;
22.
font-size: 12px;
23.
}
24.
.text{
25.
font-family: Arial, Helvetica, sans-serif;
26.
font-size: 12px;
27.
}
28.
.style1 {font-size: 16px}
29.
-->
30.
</style>
31.
</HEAD>
32.
<BODY>
33.
<form name=
"form1"
method=
"post"
action=
""
>
34.
<table width=
"627"
height=
"266"
border=
"0"
align=
"center"
>
35.
<tr>
36.
<td height=
"27"
colspan=
"3"
bgcolor=
"#FFCCFF"
><div align=
"center"
>
37.
<p>สถิติอุบัติเหตุ จ. ลพบุรี</p>
38.
</div></td>
39.
</tr>
40.
<tr>
41.
<td width=
"104"
> </td>
42.
<td width=
"339"
rowspan=
"3"
><p align=
"center"
class
=
"style1"
> </p>
43.
<p align=
"center"
>
44.
<?php
45.
46.
47.
48.
49.
50.
$link
= connectToDB();
51.
52.
53.
54.
55.
$animateChart
=
$_GET
[
'animate'
];
56.
57.
if
(
$animateChart
==
""
)
58.
$animateChart
=
"1"
;
59.
60.
61.
62.
$strXML
=
"<chart caption=' ' subCaption=' ' pieSliceDepth='30' showBorder='1' formatNumberScale='0' numberSuffix=' ' animation=' "
.
$animateChart
.
"'>"
;
63.
64.
65.
66.
67.
$strQuery
= "select t1.*,t2.women
68.
FROM (SELECT dt_district,
count
(dt_district)
as
man FROM detail where dt_sex=
'ชาย'
group by dt_district)
as
t1
69.
left join
70.
(SELECT dt_district,
count
(dt_district)
as
women FROM detail where dt_sex=
'หญิง'
group by dt_district)
as
t2
71.
on t1.dt_district=t2.dt_district";
72.
$result2
= mysql_query(
$strQuery
)
or
die
(mysql_error());
73.
74.
if
(
$result2
) {
75.
while
(
$ors2
= mysql_fetch_array(
$result2
)) {
76.
$strXML
.=
"<set label='"
.
$ors2
['dt_sex
'] . "'
value=
'" . $ors2['
'] . "'
/>";
77.
}
78.
}
79.
mysql_close(
$link
);
80.
81.
82.
$strXML
.=
"</chart>"
;
83.
84.
85.
echo
renderChart(
"../../FusionCharts/Column3D.swf"
,
""
,
$strXML
,
"FactorySum"
, 450, 250, false, false);
86.
?>