[英]MySQL REGEXP Search
I have made a search engine which works well, but I want it to disregard symbols in the database entries. 我已经做了一个搜索引擎,该引擎运行良好,但是我希望它忽略数据库条目中的符号。
eg I search for A*BC 例如我搜索A * BC
In the database I have a column that contains ABC. 在数据库中,我有一列包含ABC。
I would like it to bring back this record even thought it has symbols in. 我希望它带回该记录,甚至认为其中包含符号。
How would I do this? 我该怎么做?
Hi, I tried that but it does not work. 嗨,我试过了,但是没有用。
Here is my code: 这是我的代码:
$query = '%' . rawurlencode($queryRaw) . '%' ;
$queryClean = ereg_replace("[^A-Za-z0-9]", "%", $query) ;
$result = $dbh->prepare("SELECT supplier_details.id as supid, name, languages.languages, countries.country
FROM supplier_details, languages, countries
WHERE languageRef = languages.id
AND countryRef = countries.id
AND (name LIKE ? OR name LIKE ?)
LIMIT 50") ;
$result->bindParam(1, $query, PDO::PARAM_INT) ;
$result->bindParam(2, $queryClean, PDO::PARAM_INT) ;
$result->execute() ;
select *
from tbl
where clmn like '%A%B%C%'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.