$strSQL .= " and DORM_NEAR LIKE '%".$_POST["keywords"]."%' or DORM_NEAR2 LIKE '%".$_POST["keywords"]."%' or DORM_NEAR3 LIKE '%".$_POST["keywords"]."%'";
โค้ดทั้งหมด Code (PHP)
if($_POST["keywords"] != "" || $_POST["txtKeyword"] != "" || $_POST["checkbox1"] != "" )
{
$strSQL = "SELECT * FROM dormitory WHERE 1";
if($_POST["keywords"] != "")
{
$strSQL .= " and DORM_NEAR LIKE '%".$_POST["keywords"]."%' or DORM_NEAR2 LIKE '%".$_POST["keywords"]."%' or DORM_NEAR3 LIKE '%".$_POST["keywords"]."%'";
}
if($_POST["txtKeyword"] != "")
{
$strSQL .= " and DORM_RENT_MAX <= '".$_POST["txtKeyword"]."'";
}
if($_POST["checkbox1"] != "")
{
$strSQL .= " and DORM_INTERNET = '".$_POST["checkbox1"]."'";
}
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
}