函数FIND_IN_SET()在codeigniter中不起作用

Sup*_*rry 5 codeigniter

该函数FIND_IN_SET()在本地运行,但在服务器上不起作用。当我company_by_category_model通过调用controller(controller name)加载时 ,它将引发错误

错误:

FUNCTION firstdial.FIND_IN_SET does not exist

SELECT * FROM (`company_information`, `user_information`) 
WHERE `FIND_IN_SET` ('16',company_category) 
AND company_information.allowstatus=1 
AND company_information.delstatus=0 
AND company_information.user_id=user_information.user_id 
ORDER BY `company_id` desc

Filename: C:\wamp\www\firstdial\system\database\DB_driver.php
Line Number: 331
Run Code Online (Sandbox Code Playgroud)

码:

function company_by_category_model($category_id)
{   
    $this->db->select('*');
    $this->db->from('company_information,user_information');
    $search="FIND_IN_SET ('$category_id',company_category) 
        AND company_information.allowstatus=1 
        AND company_information.delstatus=0 
        AND company_information.user_id=user_information.user_id";
    $this->db->where($search);
    $this->db->order_by('company_id','desc');
    $query=$this->db->get();
    return $query->result();
}
Run Code Online (Sandbox Code Playgroud)

Ran*_*osh 5

您必须始终以某种方式检查 FIND_IN_SET() 函数的结果以使其工作,试试这个:

  $this->db->where("FIND_IN_SET('$value',employer_job_location) !=", 0);
Run Code Online (Sandbox Code Playgroud)