我正在尝试正确执行此查询
foreach(explode(" ", trim($words) ) as $word) $where[] = "LIKE '%$word%'";
$wheresql = implode(" OR ", $where);
$q = "SELECT item_id, name, price, details, img FROM items WHERE (details $wheresql) OR (name $wheresql) OR (description $wheresql)";
$rows = $this->dba->rawSelect($q);
查询现在看起来像这样
SELECT item_id, name, price, details, img
FROM items
WHERE (details LIKE '%someword%' OR LIKE '%someword%')
OR (name LIKE '%someword%' OR LIKE '%someword%')
OR (description LIKE '%someword%' OR LIKE '%someword%')
我不确定是否必须为每个指定列LIKE
或执行其他操作
谢谢,理查德