if(empty($_POST['txtKeyword']) && !empty($_POST['department']))
{
$Keyword = $_POST['department'];
}
else if(!empty($_POST['txtKeyword']) && empty($_POST['department']))
{
$Keyword = $_POST['txtKeyword'];
}
else
{
$Keyword = "";
echo '<script>alert("เลือกซักเงื่อนไขสิครับ");</script>';
}
$objConnect = mysql_connect("localhost","root","123456") or die("Error Connect to Database");
$objDB = mysql_select_db("mydatabase");
// Search By Name or Email
mysql_query("SET NAMES utf8");
$strSQL = "SELECT * FROM test WHERE (department LIKE '%".$Keyword."%' or name LIKE '%".$Keyword."%' or position LIKE '%".$Keyword."%')";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
09.
}
10.
else
11.
{
12.
$Keyword = "";
13.
echo '<script>alert("เลือกซักเงื่อนไขสิครับ");</script>';
14.
}
15.
$objConnect = mysql_connect("localhost","root","123456") or die("Error Connect to Database");
16.
$objDB = mysql_select_db("mydatabase");
17.
// Search By Name or Email
18.
19.
mysql_query("SET NAMES utf8");
20.
$strSQL = "SELECT * FROM test WHERE (department LIKE '%".$Keyword."%' or name LIKE '%".$Keyword."%' or position LIKE '%".$Keyword."%')";
21.
22.
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");