php mysql like如何实现多关键词搜索?
或者叫,分词检索数据库
$res = mysql_query("select * from peter where id like '%中草药%' and '%6%'"); //这样写是报错的;
$res = mysql_query("select * from peter where id like '%中草药%' or '%6%'"); //而这样写是正确的;奇怪~
$res = mysql_query("select * from peter where id like '%中草药%' and id like '%6%'"); //这样写是正确的;
$res = mysql_query("select * from peter where id like '%中草药%' or id like '%6%'"); //这样写都是正确的;
以上就是小编为大家带来的php mysql like 实现多关键词搜索的方法全部内容了,希望大家多多支持路饭~
本文地址:http://www.45fan.com/bcdm/83988.html