duanji5746 2014-01-02 12:40
浏览 42
已采纳

语法错误,意外'FIND_IN_SET'(T_STRING)[关闭]

I am using FIND_IN_SET in where condition in Codeigniter, and I am facing the following error:

syntax error, unexpected 'FIND_IN_SET' (T_STRING)

How to solve it??

My model is the following:

function getTask($id, $is_master_admin) 
{
    $this->db->select('task.*, workspace.title as workspacetitle, GROUP_CONCAT(user.title ) AS usertitle,task.assigneduserid,user,id',FALSE);
    $this->db->join(WORKSPACE , WORKSPACE . '.id = ' . TASK . '.workspaceid', 'inner');
    $this->db->join(USER,USER . '.id = ' . TASK . '.assigneduserid', 'inner');
    $this->db->from(TASK);
    $this->db->group_by("task.id");         
    if (!$is_master_admin) {
        $this->db->where FIND_IN_SET($id,"task.assigneduserid");
    }

    $this->db->where(TASK . '.tasktypeid', '1');
    if ($query->num_rows() > 0) {
        return $query->result();
    } else {
        return false;
    }
}

Please help me to solve this, thank you.

  • 写回答

2条回答 默认 最新

  • douyan5481 2014-01-02 12:44
    关注
    $this->db->where FIND_IN_SET($id,"task.assigneduserid");
    

    to

    $this->db->where("FIND_IN_SET($id, task.assigneduserid)");
    

    you forgot to open paranthesis.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥20 神经网络Sequential name=sequential, built=False
  • ¥16 Qphython 用xlrd读取excel报错
  • ¥15 单片机学习顺序问题!!
  • ¥15 ikuai客户端多拨vpn,重启总是有个别重拨不上
  • ¥20 关于#anlogic#sdram#的问题,如何解决?(关键词-performance)
  • ¥15 相敏解调 matlab
  • ¥15 求lingo代码和思路
  • ¥15 公交车和无人机协同运输
  • ¥15 stm32代码移植没反应
  • ¥15 matlab基于pde算法图像修复,为什么只能对示例图像有效