0

所以我希望能够更改搜索查询结果的列出方式。顶部(按相关性排序)有效,但是当我尝试按同一数据库中的不同变量排序时,它不起作用。有什么建议么?请和谢谢。

    if(!isset($_SESSION['sortby']) or $qsortby=="relevance")
{
    $result = 
    "SELECT *,
        MATCH (title, keywords) AGAINST ('+".$q."' IN BOOLEAN MODE) AS relevance,
        MATCH (title) AGAINST ('+".$q."' IN BOOLEAN MODE) AS title_relevance
        FROM designs
        WHERE MATCH (title, keywords) AGAINST ('".$q."')
        ORDER BY title_relevance DESC, relevance DESC";
 }
        else
        {
        $result = 
    "SELECT *,
            MATCH (title, keywords) AGAINST ('+".$q."' IN BOOLEAN MODE) AS relevance,
        FROM designs
        WHERE MATCH (title, keywords) AGAINST ('".$q."')
        ORDER BY rating DESC";
        }
4

0 回答 0