03.
<meta http-equiv=
"Content-Type"
content=
"text/html; charset=UTF-8"
/>
04.
<title>Customer Search</title>
05.
</head>
06.
<body>
07.
<form name=
"frmSearch"
method=
"get"
action=
"<?php echo $_SERVER['SCRIPT_NAME'];?>"
>
08.
<table width=
"800"
border=
"1"
color=
"#"
>
09.
<tr>
10.
<th>From
Date
11.
<input name=
"txtKeyword"
type=
"text"
id=
"txtKeyword"
value=
"<?php echo $_GET["
txtKeyword
"];?>"
>To
Date
12.
<input name=
"txtKeyword2"
type=
"text"
id=
"txtKeyword2"
value=
"<?php echo $_GET["
txtKeyword2
"];?>"
>Company
13.
<input name=
"txtKeyword3"
type=
"text"
id=
"txtKeyword3"
value=
"<?php echo $_GET["
txtKeyword3
"];?>"
>
14.
<input type=
"submit"
value=
"Search"
></th>
15.
</tr>
16.
</table>
17.
</form>
18.
<?php
19.
if
(
$_GET
[
"txtKeyword"
] !=
""
or
$_GET
[
"txtKeyword2"
] !=
""
or
$_GET
[
"txtKeyword3"
] !=
""
)
20.
{
21.
$objConnect
= mysql_connect(
"localhost"
,
"root"
,
"03112530"
)
or
die
(
"Error Connect to Database"
);
22.
$objDB
= mysql_select_db(
"customer"
);
23.
24.
$strSQL
=
"SELECT * FROM cus WHERE (Date between '"
.
$_GET
[
"txtKeyword"
].
"' and '"
.
$_GET
[
"txtKeyword2"
].
"' and Company LIKE '%"
.
$_GET
[
"txtKeyword3"
].
"%')"
;
25.
$objQuery
= mysql_query(
$strSQL
)
or
die
(
"Error Query ["
.
$strSQL
.
"]"
);
26.
?>
27.
<table width=
"800"
border=
"1"
>
28.
<tr>
29.
<th width=
"91"
align=
"center"
>Id </th>
30.
<th width=
"91"
align=
"center"
>Company </th>
31.
<th width=
"91"
align=
"center"
>Code </th>
32.
<th width=
"91"
align=
"center"
>Name_save </th>
33.
<th width=
"91"
align=
"center"
>Name_pro </th>
34.
<th width=
"91"
align=
"center"
>Piece </th>
35.
<th width=
"91"
align=
"center"
>
Date
</th>
36.
37.
</tr>
38.
<?php
39.
while
(
$objResult
= mysql_fetch_array(
$objQuery
))
40.
{
41.
?>
42.
<tr>
43.
<td align=
"center"
><?php
echo
$objResult
[
"Id"
];?></td>
44.
<td align=
"center"
><?php
echo
$objResult
[
"Company"
];?></td>
45.
<td align=
"center"
><?php
echo
$objResult
[
"Code"
];?></td>
46.
<td align=
"center"
><?php
echo
$objResult
[
"Name_save"
];?></td>
47.
<td align=
"center"
><?php
echo
$objResult
[
"Name_pro"
];?></td>
48.
<td align=
"center"
><?php
echo
$objResult
[
"Piece"
];?></td>
49.
<td align=
"center"
><?php
echo
$objResult
[
"Date"
];?></td>
50.
</tr>
51.
<?php
52.
}
53.
?>
54.
</table>
55.
<table width=
"800"
border=
"1"
>
56.
<tr>
57.
<th width=
"91"
> </th>
58.
<th width=
"91"
> </th>
59.
<th width=
"91"
> </th>
60.
<th width=
"91"
> </th>
61.
<th width=
"91"
align=
"center"
>จำนวนชิ้น</th>
62.
<th width=
"91"
align=
"center"
><?PHP
63.
$objConnect
= mysql_connect(
"localhost"
,
"root"
,
"03112530"
)
or
die
(
"Error Connect to Database"
);
64.
$objDB
= mysql_select_db(
"customer"
);
65.
$SQL
=
"SELECT SUM(Piece) AS SUMPiece FROM customer WHERE Id ='"
.
$_GET
[
"Id"
].
"'"
;
66.
?></th>
67.
<th width=
"91"
> </th>
68.
</tr>
69.
</table>
70.
<?php
71.
mysql_close(
$objConnect
);
72.
}
73.
?>