-
- $keyword="1 2 3";
- echo $sql=search($keyword,"enter_gongyin_pic","a+b+c"); / /函數生成,沒有LIMIT,沒有ORDER BY
-
複製程式碼
產生sql語句:
-
- SELECT * FROM `enter_gongyin_pic` WHERE `a` LIKE '%1%' OR `a` LIKE '%2%' OR `a` LIKE ' %3%' OR `b` LIKE '%1%' OR `b` LIKE '%2%' OR `b` LIKE '%3%' OR `c` LIKE '%1%' OR `c` LIKE ' %2%' OR `c` LIKE '%3%'
複製程式碼
$keyword由POST或GET取得,按空格分開,可以多字段去查找.
多關鍵字、多字段產生sql查詢語句的函數:
|