出了什麼問題:Mysql的比賽......對與簡單的像「一詞%%」
$term = $_POST['search'];
function buildQuery($exploded,$count,$query)
{
if(count($exploded)>$count)
{
$query.= ' AND column LIKE "%'. $exploded[$count] .'%"';
return buildQuery($exploded,$count+1,$query);
}
return $query;
}
$exploded = explode(' ',$term);
$query = buildQuery($exploded,1,
'SELECT * FROM table WHERE column LIKE "%'. $exploded[0] .'%"');
,然後查詢數據庫檢索按照一定的順序結果,而不是使用專用的MyISAM sql匹配...反對?
它會大幅度降低性能嗎?
順便說一句我知道這個話題已經完全badgered和濫用。 – Gal 2009-12-24 01:30:42