MYSQL和PHP全文搜索

时间:2015-07-27 12:10:36

标签: php mysql

我有以下两个问题:

$s_name = $this->input->post('check_sur_name');
        $sql = "SELECT * FROM patient WHERE MATCH(s_name) AGAINST ('$s_name' IN BOOLEAN MODE ) or MATCH(f_name) AGAINST (''  IN BOOLEAN MODE)";
        $query = $this->db->query($sql);
        $query = $query->result_array();

        echo json_encode($query);

这是第二个:

$sql = "SELECT * FROM patient WHERE MATCH(s_name) AGAINST ('Mugabe' IN BOOLEAN MODE ) or MATCH(f_name) AGAINST (''  IN BOOLEAN MODE)";
$query = $this->db->query($sql);
$query = $query->result_array();

echo json_encode($query);

第二个脚本运行得很好,并给我一个反馈,但第一个脚本一直在失败,请告诉我在第一个脚本中做错了什么?

0 个答案:

没有答案