$strSQL = "SELECT top(100) detail.ThaiName, detail.EngName, tel.tel, fax.fax, contact.con_name, contact.c_name, contact.c_lastname, contact.c_add,
contact.c_province, contact.c_amphur, contact.c_district, contact.c_zip, contact_tel.c_tel
FROM detail INNER JOIN
tel ON detail.id_detail = tel.id_detail INNER JOIN
fax ON detail.id_detail = fax.id_detail INNER JOIN
contact ON detail.id_detail = contact.id_detail INNER JOIN
contact_tel ON contact.id_con = contact_tel.id_con
WHERE detail.Enable='T' AND detail.IsActive='T' AND
(tel.tel LIKE '%".$keyword[0]."%' or fax.fax LIKE '%".$keyword[0]."%' or contact_tel.c_tel LIKE '%".$keyword[0]."%' or detail.hotline LIKE '%".$keyword[0]."%')
and
(tel.tel LIKE '%".$keyword[1]."%' or fax.fax LIKE '%".$keyword[1]."%' or contact_tel.c_tel LIKE '%".$keyword[1]."%' or detail.hotline LIKE '%".$keyword[1]."%')
and
(tel.tel LIKE '%".$keyword[2]."%' or fax.fax LIKE '%".$keyword[2]."%' or contact_tel.c_tel LIKE '%".$keyword[2]."%' or detail.hotline LIKE '%".$keyword[2]."%')
and
(tel.tel LIKE '%".$keyword[3]."%' or fax.fax LIKE '%".$keyword[3]."%' or contact_tel.c_tel LIKE '%".$keyword[3]."%' or detail.hotline LIKE '%".$keyword[3]."%')
and
(tel.tel LIKE '%".$keyword[4]."%' or fax.fax LIKE '%".$keyword[4]."%' or contact_tel.c_tel LIKE '%".$keyword[4]."%' or detail.hotline LIKE '%".$keyword[4]."%')
and
(tel.tel LIKE '%".$keyword[5]."%' or fax.fax LIKE '%".$keyword[5]."%' or contact_tel.c_tel LIKE '%".$keyword[5]."%' or detail.hotline LIKE '%".$keyword[5]."%')
and
(tel.tel LIKE '%".$keyword[6]."%' or fax.fax LIKE '%".$keyword[6]."%' or contact_tel.c_tel LIKE '%".$keyword[6]."%' or detail.hotline LIKE '%".$keyword[6]."%')
and
(tel.tel LIKE '%".$keyword[7]."%' or fax.fax LIKE '%".$keyword[7]."%' or contact_tel.c_tel LIKE '%".$keyword[7]."%' or detail.hotline LIKE '%".$keyword[7]."%')
and
(tel.tel LIKE '%".$keyword[8]."%' or fax.fax LIKE '%".$keyword[8]."%' or contact_tel.c_tel LIKE '%".$keyword[8]."%' or detail.hotline LIKE '%".$keyword[8]."%')
and
(tel.tel LIKE '%".$keyword[9]."%' or fax.fax LIKE '%".$keyword[9]."%' or contact_tel.c_tel LIKE '%".$keyword[9]."%' or detail.hotline LIKE '%".$keyword[9]."%')";
if($_GET["txtKeyword2"]!= "")
{
$strSQL .= " and (detail.province LIKE '%".$_GET["txtKeyword2"]."%') ";
}}
$objQuery = mssql_query($strSQL) or die ("Error Query [".$strSQL."]");
while($objResult = mssql_fetch_array($objQuery))
mssql_result($objQuery,$i,"tel")." ";
}
$strSQL = "SELECT detail.ThaiName, detail.EngName, detail.word, detail.type, detail.orther, detail.Address, detail.province, detail.amphur, detail.district, detail.zip,
detail.mail, detail.web, detail.hotline, detail.busi, detail.bg, detail.service, detail.etc, detail.detail, detail.price, detail.branch, detail.commonday, detail.holiday,
detail.note, detail.town1, detail.town2, detail.town3, detail.town4, detail.rate, detail.Created, detail.CreatedBy, detail.CreatedTime, detail.Updated,
detail.UpdatedBy, detail.UpdatedTime, detail.IsSecret, detail.IsActive, detail.Enable, detail.Deleted, detail.DeletedBy, detail.DeletedTime, tel.tel, fax.fax, contact.con_name, contact.c_name, contact.c_lastname, contact.c_add,
contact.c_province, contact.c_amphur, contact.c_district, contact.c_zip, contact_tel.c_tel
FROM detail INNER JOIN
tel ON detail.id_detail = tel.id_detail INNER JOIN
fax ON detail.id_detail = fax.id_detail INNER JOIN
contact ON detail.id_detail = contact.id_detail INNER JOIN
contact_tel ON contact.id_con = contact_tel.id_con
WHERE detail.Enable='T' AND detail.IsActive='T' AND
(tel.tel LIKE '%".$keyword[0]."%' or fax.fax LIKE '%".$keyword[0]."%' or contact_tel.c_tel LIKE '%".$keyword[0]."%' or detail.hotline LIKE '%".$keyword[0]."%')
and
(tel.tel LIKE '%".$keyword[1]."%' or fax.fax LIKE '%".$keyword[1]."%' or contact_tel.c_tel LIKE '%".$keyword[1]."%' or detail.hotline LIKE '%".$keyword[1]."%')
and
(tel.tel LIKE '%".$keyword[2]."%' or fax.fax LIKE '%".$keyword[2]."%' or contact_tel.c_tel LIKE '%".$keyword[2]."%' or detail.hotline LIKE '%".$keyword[2]."%')
and
(tel.tel LIKE '%".$keyword[3]."%' or fax.fax LIKE '%".$keyword[3]."%' or contact_tel.c_tel LIKE '%".$keyword[3]."%' or detail.hotline LIKE '%".$keyword[3]."%')
and
(tel.tel LIKE '%".$keyword[4]."%' or fax.fax LIKE '%".$keyword[4]."%' or contact_tel.c_tel LIKE '%".$keyword[4]."%' or detail.hotline LIKE '%".$keyword[4]."%')
and
(tel.tel LIKE '%".$keyword[5]."%' or fax.fax LIKE '%".$keyword[5]."%' or contact_tel.c_tel LIKE '%".$keyword[5]."%' or detail.hotline LIKE '%".$keyword[5]."%')
and
(tel.tel LIKE '%".$keyword[6]."%' or fax.fax LIKE '%".$keyword[6]."%' or contact_tel.c_tel LIKE '%".$keyword[6]."%' or detail.hotline LIKE '%".$keyword[6]."%')
and
(tel.tel LIKE '%".$keyword[7]."%' or fax.fax LIKE '%".$keyword[7]."%' or contact_tel.c_tel LIKE '%".$keyword[7]."%' or detail.hotline LIKE '%".$keyword[7]."%')
and
(tel.tel LIKE '%".$keyword[8]."%' or fax.fax LIKE '%".$keyword[8]."%' or contact_tel.c_tel LIKE '%".$keyword[8]."%' or detail.hotline LIKE '%".$keyword[8]."%')
and
(tel.tel LIKE '%".$keyword[9]."%' or fax.fax LIKE '%".$keyword[9]."%' or contact_tel.c_tel LIKE '%".$keyword[9]."%' or detail.hotline LIKE '%".$keyword[9]."%')";
if($_GET["txtKeyword2"]!= "")
{
$strSQL .= " and (detail.province LIKE '%".$_GET["txtKeyword2"]."%') ";
}
$objQuery = mssql_query($strSQL) or die ("Error Query [".$strSQL."]");
while($objResult = mssql_fetch_array($objQuery)) {?>
<?=$objResult["tel"]." ";
}}
?>