01.
<html>
02.
<head>
03.
<title> Search </title>
04.
</head>
05.
<body>
06.
<form name=
"frmSearch"
method=
"get"
action=
"<?=$_SERVER['search12.htm'];?>"
>
07.
<table width=
"599"
border=
"1"
>
08.
<tr>
09.
<th>Keyword
10.
<input name=
"txtKeyword"
type=
"text"
id=
"txtKeyword"
value=
"<?=$_GET["
txtKeyword
"]; ?>"
>
11.
<input type=
"submit"
value=
"Search"
></th>
12.
</tr>
13.
</table>
14.
</form>
15.
<?php
16.
if
(
$_GET
[
"txtKeyword"
] !=
""
)
17.
{
18.
$objConnect
= mysql_connect(
"localhost"
,
"root"
,
"owl3f3311"
)
or
die
(
"Error Connect to Database"
);
19.
$objDB
= mysql_select_db(
"company"
);
20.
21.
$strSQL
=
"SELECT * FROM Transactions WHERE (Trans_id LIKE '%"
.
$_GET
[
"txtKeyword"
].
"%' or product_id LIKE '%"
.
$_GET
[
"txtKeyword"
].
"%' )"
;
22.
$objQuery
= mysql_query(
$strSQL
)
or
die
(
"Error Query ["
.
$strSQL
.
"]"
);
23.
?>
24.
<table width=
"600"
border=
"1"
>
25.
<tr>
26.
<th width=
"91"
> <div align=
"center"
>Trans_id </div></th>
27.
<th width=
"98"
> <div align=
"center"
>
Date
</div></th>
28.
<th width=
"198"
> <div align=
"center"
>Product_id</div></th>
29.
<th width=
"97"
> <div align=
"center"
>Customer_id </div></th>
30.
<th width=
"71"
> <div align=
"center"
>QTY </div></th>
31.
</tr>
32.
<?
33.
while
(
$objResult
= mysql_fetch_array(
$objQuery
))
34.
{
35.
?>
36.
<tr>
37.
<td align=
"center"
><?=
$objResult
[
"Trans_id"
];?></td>
38.
<td align=
"center"
><?=
$objResult
[
"Date"
];?></td>
39.
<td><div align=
"center"
><?=
$objResult
[
"Product_id"
];?></div></td>
40.
<td><div align=
"center"
><?=
$objResult
[
"Customer_id"
];?></div></td>
41.
<td align=
"right"
><?=
$objResult
[
"QTY"
];?></td>
42.
</tr>
43.
<?
44.
}
45.
?>
46.
</table>
47.
<?
48.
mysql_close(
$objConnect
);
49.
}
50.
?>
51.
</body>
52.
</html>