2015-08-23 56 views
0

我使用這個功能搜索相關的標題:PHP MySQL的內容過濾值相關內容

$related = Access::FETCH("SELECT title, MATCH(title) AGAINST('".$DB_QUERY[0]['title']."') AS score 
       FROM " . SONGS . " 
       WHERE MATCH(title) AGAINST('".$DB_QUERY[0]['title']."') 
       ORDER BY score DESC LIMIT 5"); 
foreach($related as $row){ 
    echo $row['title']; 
} 

即:

//search title clapton 
$DB_QUERY[0]['title'] = 'clapton'; 
//result 
clapton // same title 
eric clapton 
clapton song 
clapton guitar 

這爲我工作,但在結果的搜索和打印相同的標題+其他標題。我怎麼能找到沒有顯示相同標題的相關標題?

+0

如果溝'稱號,'部分是什麼?我想我錯過了什麼,對不起 – Drew

回答

1

可以使用

"SELECT title, MATCH(title) AGAINST('".$DB_QUERY[0]['title']."') AS score 
      FROM " . SONGS . " 
      WHERE MATCH(title) AGAINST('".$DB_QUERY[0]['title']."') 
      and title <> '".$DB_QUERY[0]['title']."' 
      ORDER BY score DESC LIMIT 5"