如何使我的网站中的搜索结果有序显示

时间:2018-08-04 10:40:50

标签: php mysql

$sql = "SELECT * 
FROM listing 
WHERE (MATCH(dir_heading) 
AGAINST ('$wtfld' IN BOOLEAN MODE)) AND busns_suburb LIKE '%".$whrfld."%' " ;

我想在此代码中添加ORDER BY,但无法正确实现。

1 个答案:

答案 0 :(得分:0)

如我在上面的评论中所述,请按照where子句添加顺序:

$sql = "SELECT * 
FROM listing 
WHERE (MATCH(dir_heading) 
AGAINST ('$wtfld' IN BOOLEAN MODE)) AND busns_suburb LIKE '%".$whrfld."%' 
ORDER BY busns_name;" ;