<form name="frmSearch" method="get" action="<?=$_SERVER['SCRIPT_NAME'];?>">
<table width="599" border="1" align="center">
<tr>
<th>คำค้น
<input name="txtKeyword" type="text" id="txtKeyword" value="<?=$_GET["txtKeyword"];?>">
<input type="submit" value="Search"></th>
</tr>
</table>
</form>
<?
if($_GET["txtKeyword"] != "")
{
include("connect.php");
// 3. นำคำสั่ง sql ไปทำการประมาวลผลที่ฐานข้อมูล
$sql ="select a.* ,b.p_num,c.p_adv_num , c.p_adv_fname , c.p_adv_sname, e.p_gra_w ,f.p_aca_w ,g.p_sta from senior_n a
left join senior_num b on a.p_numkey = b.p_numkey
left join senior_adv c on a.p_adv = c.p_adv
left join senior_gra e on a.p_gra = e.p_gra
left join senior_aca f on a.p_aca = f.p_aca
left join senior_sta g on a.p_sta_key = g.p_sta_key
WHERE ( p_name LIKE '%".$_GET["txtKeyword"]."%' or p_id LIKE '%".$_GET["txtKeyword"]."%'or
p_stu_fname LIKE '%".$_GET["txtKeyword"]."%' or p_stu_sname LIKE '%".$_GET["txtKeyword"]."%' or
p_aca_w LIKE '%".$_GET["txtKeyword"]."%' or p_adv_fname LIKE '%".$_GET["txtKeyword"]."%' or
p_adv_sname LIKE '%".$_GET["txtKeyword"]."%' or p_gra_w LIKE '%".$_GET["txtKeyword"]."%' or p_sta LIKE '%".$_GET["txtKeyword"]."%')";
$objQuery = mysql_query($sql) or die ("Error Query [".$sql."]");
$Num_Rows = mysql_num_rows($objQuery);