iLlegal混合排序操作'匹配#39;

时间:2015-02-09 18:12:34

标签: php mysql

嗨我正在尝试使用搜索栏匹配goods_id或名称,但当我在match()上使用它时,我得到了这个问题“非法混合排序(latin1_swedish_ci,NUMERIC)和(utf8_general_ci,IMPLICIT)进行操作” match'“name is utf8_general_ci和FULLTEXT index goods_id是主键AUTO INCRE。代码:for mysql:

function search(){
    $search = clear($_GET['search']);
    $result_search = array();

    if(mb_strlen($search, 'UTF-8') < 1){
        $result_search['notfound'] = "<div class='error'>min. 1 Letters</div>";
    }else{
        $query = "SELECT goods_id, name, img, price, hits, new, sale
                    FROM goodsbase
                    WHERE MATCH(goods_id, name) AGAINST('{$search}*' IN BOOLEAN MODE) 
                        AND visible='1'";
        $res = mysql_query($query) or die(mysql_error());

        if(mysql_num_rows($res) > 0){
            while($row_search = mysql_fetch_assoc($res)){
                $result_search[] = $row_search;
            }
        }else{
            $result_search['notfound'] = "<div class='error'>NO MATCH!!!</div>";
        }
    }

    return $result_search;
}

可以帮助吗? THX ...

0 个答案:

没有答案