01.
<?php
02.
03.
04.
$strExcelFileName
=
"Member-All.xls"
;
05.
header(
"Content-Type: application/x-msexcel; name=\"$strExcelFileName\""
);
06.
header(
"Content-Disposition: inline; filename=\"$strExcelFileName\""
);
07.
header(
"Pragma:no-cache"
);
08.
09.
include
'function.inc.php'
;
10.
include
(
'connectdb.php'
);
11.
$strSQL
= "SELECT *
12.
FROM personnel";
13.
$objQuery
= mysql_query(
$strSQL
)
or
die
(
"ไม่สามารถเชื่อมต่อได้"
);
14.
$num
=mysql_num_rows(
$strSQL
);
15.
?>
16.
18.
20.
<html>
21.
<head>
22.
<meta http-equiv=
"Content-Type"
content=
"text/html; charset=utf-8"
/>
23.
</head>
24.
<body>
25.
26.
<strong>ข้อมูลบุคลากร วันที่ <?php
echo
thaidate(
$curdate
); ?></strong><br>
27.
<br>
28.
<div id=
"SiXhEaD_Excel"
align=center x:publishsource=
"Excel"
>
29.
<table x:str border=1 cellpadding=0 cellspacing=1 width=100% style=
"border-collapse:collapse"
>
30.
<tr>
31.
<td width=
"94"
height=
"30"
align=
"center"
valign=
"middle"
><strong>ชื่อ-สกุล</strong></td>
32.
<td width=
"200"
align=
"center"
valign=
"middle"
><strong>ภาค</strong></td>
33.
34.
</tr>
35.
<?php
36.
while
(
$objResult
= mysql_fetch_array(
$objQuery
))
37.
{
38.
?>
39.
40.
<tr>
41.
<td><div
class
=
"div2"
><?php
echo
$objResult
[
"name"
];?></div></td>
42.
<td><div
class
=
"div2"
><?php
echo
$objResult
[
"department"
];?></div></td>
43.
44.
</tr>
45.
<?php
46.
}
47.
48.
?>
49.
</table>
50.
</div>
51.
<script>
52.
window.onbeforeunload =
function
(){
return
false;};
53.
setTimeout(
function
(){window.close();}, 10000);
54.
</script>
55.
</body>
56.
</html>