<form name="Search" method="get" action="<?=$_SERVER['SCRIPT_NAME'];?>">
<table width="400" border="1">
<tr>
<th>ค้นหาผู้ที่เข้ามาใช้งาน
<input name="txtKeyword" type="text" id="txtKeyword" value="<?=$_GET["txtKeyword"];?>">
<input type="submit" onClick="window.open('search3.php', 'popup', 'height=1000,width=3000, left=450,top=150');" value="Search"></th>
</tr>
</table>
</form>
<?
//if($_GET["txtKeyword"] != "")
if($_GET)
{
$objConnect = mysql_connect("srvpgm4.shaiyo-aa.com","root","qKZOAe") or die("Error Connect to Database");
$objDB = mysql_select_db("supportdbx");
// Search By Name or Email
$strSQL = "SELECT * FROM db_itpolicy WHERE (first_name LIKE '%".$_GET["txtKeyword"]."%' or last_name LIKE '%".$_GET["txtKeyword"]."%' or email LIKE '%".$_GET["txtKeyword"]."%' or user_id LIKE '%".$_GET["txtKeyword"]."%' or date_user LIKE '%".$_GET["txtKeyword"]."%' or time_user LIKE '%".$_GET["txtKeyword"]."%' )";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
mysql_close($objConnect);
'search3.php'
Code (PHP)
<?
$objConnect = mysql_connect("srvpgm4.shaiyo-aa.com","root","qKZOAe") or die("Error Connect to Database");
$objDB = mysql_select_db("supportdbx");
// Search By Name or Email
$strSQL = "SELECT * FROM db_itpolicy WHERE (first_name LIKE '%".$_GET["txtKeyword"]."%' or last_name LIKE '%".$_GET["txtKeyword"]."%' or email LIKE '%".$_GET["txtKeyword"]."%' or user_id LIKE '%".$_GET["txtKeyword"]."%' or date_user LIKE '%".$_GET["txtKeyword"]."%' or time_user LIKE '%".$_GET["txtKeyword"]."%' )";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
?>
<table border =1 width = "100%">
<tr><th colspan=6></tr></th>
<tr bgcolor="#FFFFCC">
<td class = "hs122" align = center ><B>Firstname</B></td><td td class = "hs122" align = center ><B>Lastname</B></td><td td class = "hs122" align = center ><B>Email</B></td><td td class = "hs122" align = center ><B>User_Id</B></td><td td class = "hs122" align = center ><B>Date_Request</B></td><td td class = "hs122" align = center ><B>Time_Request</B></td>
</tr>
<H4>
<?
while($objResult = mysql_fetch_array($objQuery))
{
?>
<tr>
<td><div align="center"><?=$objResult["first_name"];?></div></td>
<td><div align="center"><?=$objResult["last_name"];?></div></td>
<td><div align="center"><?=$objResult["email"];?></div></td>
<td><div align="center"><?=$objResult["user_id"];?></div></td>
<td ><div align="center"><?=$objResult["date_user"];?></div></td>
<td ><div align="center"><?=$objResult["time_user"];?></div></td>
</tr>
<?
}
?>
</table>
<?
จากที่โพส มันจะแสดง ค่าทั้งหมดที่อยู่ใน db ออกมาอ่าครับ แต่ผมต้องการค่าที่ค้นหาเท่านั้น