01.
<form action=
""
method=
"post"
id=
"form1"
name=
"form1"
>
02.
<select name=
"select_depart"
id=
"select_depart"
style=
"width:100px"
>
03.
<option value=
""
selected>เลือกแผนก</option>
04.
<?php
05.
include
(
"connection.php"
);
06.
$sql
=
"select * from depart order by depart_name ASC"
;
07.
$dbquery
=mysql_db_query(
$db
,
$sql
);
08.
while
(
$result
=mysql_fetch_array(
$dbquery
)){
09.
if
(
$depart_name
==
$result
[depart_name]){
10.
?>
11.
<option value=
"<?=$result[depart_name];?>"
selected=
"selected"
><?=
$result
[depart_name];?></option>
12.
<?
13.
}
else
{
14.
?>
15.
<option value=
"<?=$result[depart_name];?>"
><?=
$result
[depart_name];?></option>
16.
<?
17.
} }
18.
?>
19.
</select>
20.
21.
<input type=
"submit"
name=
"button"
id=
"button"
value=
"Submit"
/>
22.
23.
</form>
24.
<?php
25.
$select_depart
=
$_POST
[
"select_depart"
];
26.
if
(!
empty
(
$select_depart
))
27.
{
28.
include
(
"connection.php"
);
29.
$sql
= " SELECT savecom.type,
30.
savecom.asset_code,
31.
savecom.employee_name,
32.
savecom.depart_name,
33.
savemon.asset_code,
34.
savemon.type,
35.
savemon.employee_name,
36.
savemon.depart_name,
37.
saveprint.type,
38.
saveprint.asset_code,
39.
saveprint.employee_name
40.
FROM savecom LEFT JOIN savemon ON savecom.employee_name = savemon.employee_name
41.
LEFT JOIN saveprint ON savecom.employee_name = saveprint.employee_name
42.
WHERE (savecom.employee_name LIKE
'%$select_depart%'
)
or
(savecom.depart_name LIKE
'%$select_depart%'
)
or
(savemon.employee_name LIKE
'%$select_depart%'
)
or
(savemon.depart_name LIKE
'%$select_depart%'
)
or
(saveprint.employee_name LIKE
'%$select_depart%'
)";
43.
$sqlquery
=mysql_db_query(
$db
,
$sql
);
44.
$row
=mysql_num_rows(
$sqlquery
);
45.
if
(
$row
==0){
46.
echo
"ไม่พบข้อมูล"
;
47.
}
48.
else
if
(
$row
!=0){
49.
?>
50.
<table id=
"box-table-a"
align=
"center"
width=
"600"
border=
"1"
cellspacing=
"0"
>
51.
<tr>
52.
<th width=
"30"
> <div align=
"center"
>ลำดับที่</div></th>
53.
<th width=
"60"
> <div align=
"center"
>ชื่อพนักงาน</div></th>
54.
<th width=
"60"
> <div align=
"center"
>ชื่อแผนก</div></th>
55.
<th width=
"120"
colspan=
"3"
> <div align=
"center"
>ประเภทคุรุภัณฑ์</div></th>
56.
</tr>
57.
<?
58.
$sequence
=1;
59.
while
(
$sequence
<=
$row
)
60.
{
61.
while
(
$result_sub
=mysql_fetch_array(
$sqlquery
))
62.
{
63.
?>
64.
<tr>
65.
<td><div align=
"center"
><?=
$sequence
++;?></div></td>
66.
<td><div align=
"center"
><?=
$result_sub
[2];?></div></td>
67.
<td><div align=
"center"
><?=
$result_sub
[3];?></div></td>
68.
<td width=
"40"
><div align=
"center"
><?
if
(
$row
>=1){?><a href=
"main.php?page=showdata&asset=<?=$result_sub[0];?>&code=<?=$result_sub[1];?>"
>computer<? } ?></a></div></td>
69.
<!--<td width=
"40"
><div align=
"center"
><?
if
(!
empty
(
$result_sub
[0])){ ?><a href=
"main.php?page=showdata&asset=<?=$result_sub[0];?>&code=<?=$result_sub[1];?>"
>computer<? } ?></a></div></td> -->
70.
<td width=
"40"
><div align=
"center"
><?
if
(!
empty
(
$result_sub
[5])){ ?><a href=
"main.php?page=showdata&asset=<?=$result_sub[5];?>&code=<?=$result_sub[4];?>"
>monitor<? } ?></a></div></td>
71.
<td width=
"40"
><div align=
"center"
><?
if
(!
empty
(
$result_sub
[8])){ ?><a href=
"main.php?page=showdata&asset=<?=$result_sub[8];?>&code=<?=$result_sub[9];?>"
>printer<? } ?></a></div></td>
72.
</tr>
73.
<?
74.
}
75.
?>
76.
</table>
77.
<?
78.
}}}
79.
?>