$con = mysql_connect("$host","$user","$password");
mysql_select_db("$dbname", $con);
mysql_query("SET NAMES UTF8");
mysql_query("SET character_set_results=utf8");
mysql_query("SET character_set_client='utf8'");
mysql_query("SET character_set_connection='utf8'");
mysql_query("collation_connection = utf8_unicode_ci");
mysql_query("collation_database = utf8_unicode_ci");
mysql_query("collation_server = utf8_unicode_ci");
$strSQL = "SELECT * FROM passadu";
$strSQL .= " left join device on passadu.DeviceID = device.DeviceID";
$strSQL .= " left join hw_status on passadu.hw_status_id = hw_status.hw_status_id";
$strSQL .= " left join passadu_brand on passadu.passadu_brand_id = passadu_brand.passadu_brand_id";
$strSQL .= " left join passadu_get on passadu.passadu_get_id = passadu_get.passadu_get_id";
$strSQL .= " left join passadu_group on passadu.passadu_group_id = passadu_group.passadu_group_id";
$strSQL .= " left join tb_subcatalog on passadu.passadu_store_id = tb_subcatalog.sub_id";
$strSQL .= " where passadu.show = '1'";
if($_POST["txtKeyword"] != "")
{
$strSQL .= " AND (passadu.comID LIKE '%".$_POST["txtKeyword"]."%' or passadu.SerialNumber LIKE '%".$_POST["txtKeyword"]."%' ) ";
$strSQL .= " or (device.DeviceName LIKE '%".$_POST["txtKeyword"]."%' or passadu_brand.passadu_brand_name LIKE '%".$_POST["txtKeyword"]."%' ) ";
$strSQL .= " or (passadu.Model LIKE '%".$_POST["txtKeyword"]."%' or passadu.comeindate LIKE '%".$_POST["txtKeyword"]."%' ) ";
$strSQL .= " or (passadu.shop LIKE '%".$_POST["txtKeyword"]."%' or passadu.price LIKE '%".$_POST["txtKeyword"]."%' ) ";
$strSQL .= " or (passadu_group.passadu_group_name LIKE '%".$_POST["txtKeyword"]."%' or tb_subcatalog.sub_name LIKE '%".$_POST["txtKeyword"]."%' ) ";
$strSQL .= " or (hw_status.hw_detail LIKE '%".$_POST["txtKeyword"]."%' or passadu.price LIKE '%".$_POST["txtKeyword"]."%' ) ";
}
$strSQL .= " order by tb_subcatalog.cat_id ";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
?>
Error Query [SELECT * FROM passadu left join device on passadu.DeviceID = device.DeviceID left join hw_status on passadu.hw_status_id = hw_status.hw_status_id left join passadu_brand on passadu.passadu_brand_id = passadu_brand.passadu_brand_id left join passadu_get on passadu.passadu_get_id = passadu_get.passadu_get_id left join passadu_group on passadu.passadu_group_id = passadu_group.passadu_group_id left join tb_subcatalog on passadu.passadu_store_id = tb_subcatalog.sub_id where passadu.show = '1' AND (passadu.comID LIKE '%คอม%' or passadu.SerialNumber LIKE '%คอม%' ) or (device.DeviceName LIKE '%คอม%' or passadu_brand.passadu_brand_name LIKE '%คอม%' ) or (passadu.Model LIKE '%คอม%' or passadu.comeindate LIKE '%คอม%' ) or (passadu.shop LIKE '%คอม%' or passadu.price LIKE '%คอม%' ) or (passadu_group.passadu_group_name LIKE '%คอม%' or tb_subcatalog.sub_name LIKE '%คอม%' ) or (hw_status.hw_detail LIKE '%คอม%' or passadu.price LIKE '%คอม%' ) order by tb_subcatalog.cat_id ]