|
|
|
อยากวิธีใช้ keyword 2 ชนิดในการค้นหาข้อมูลในหน้าเว็บ โดยแบ่งเงื่อนไขโดยใช้ติ้กที่ radio เพื่อเลือก keyword |
|
|
|
|
|
|
|
แนวทางครับ
Code (PHP)
<?
$strSQL = "SELECT * FROM table WHERE 1 ";
if($_POST["txt1"] != "")
{
$strSQL .= " AND F1 = '".$_POST["txt1"]."' ";
}
if($_POST["txt2"] != "")
{
$strSQL .= " AND F2 = '".$_POST["txt2"]."' ";
}
?>
|
|
|
|
|
Date :
2016-02-24 09:58:28 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ได้แล้วค้าบ แชร์ๆ
Code (PHP)
if(isset($_REQUEST["IQRID"]) || isset($_REQUEST["RT_NO"]) )
{
$strIQRID = $_REQUEST["IQRID"];
$strRT_NO = $_REQUEST["RT_NO"];
$strSql = "";
$strSql .= "SELECT ID, IQRID, RT_NO, FBN_PN, PN_DESCRIPTION, CUSTOMER, MFG_PN, MFG_NAME, SUPPLIER_CODE, DATECODE, LOTCODE, REVISION, EXPDATE, MSDLEVEL, EN,
DATETIME, QTY, RECORD_MODE, ORACLE_TIMESTAMP, FITS_TIMESTAMP FROM dbo.XXIQA_TO_FITS ";
$strSql .= " Where 1=1 ";
if($_REQUEST["IQRID"] != "")
$strSql .= " AND IQRID like '".str_replace("*","%",$strIQRID)."' ";
if($_REQUEST["RT_NO"] != "")
$strSql .= " AND RT_NO like '".str_replace("*","%",$strRT_NO)."' ";
//echo $strSql ;
$result = mssql_query($strSql, $link) or die('MSSQL error: ' . mssql_get_last_message());
$total = mssql_num_rows($result);
if($total > 0)
{
$row = mssql_fetch_array($result);
//echo "<pre>".print_r($row,true)."</pre>";
}
//echo $total;
//echo "<pre>".print_r($result,true)."</pre>";
}
|
|
|
|
|
Date :
2016-02-24 15:47:02 |
By :
kriszy |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
จัดไป
|
|
|
|
|
Date :
2016-02-25 09:35:59 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|