1
我已經做出了一個很好的搜索引擎,但我希望它忽略數據庫條目中的符號。MySQL REGEXP搜索
例如我搜索A * B-C
在數據庫中,我有一個包含ABC的列。
我想它帶回這個紀錄甚至認爲它有我會怎麼做這英寸
符號?
嗨,我試過,但它不起作用。
這裏是我的代碼:
$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() ;