We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

phalcon update multiple records

        $cid = trim($this->request->get("cid"));
        if (empty($cid))
            throw new Exception("获取评论ID失败");
        $cid_str = ltrim($cid,",");
        $cid_arr = explode(",",$cid_str);
        $commentsmodel = new CommentsModel;
        $comments = $commentsmodel->find("cid in $cid_str");
        $comments->del_status = 1;
        $comments->update_time = NOW_TIME;
        $comments->op_user = $this->loginUser["username"];
        $comments->op_uid = $this->loginUser["uid"];
        if ($comments->update() == false)
        {
            echo "0";
            $this->view->disable();
        } else
        {
            echo "1";
            $this->view->disable();
        }

What's the problem?



1.8k

I want to perform this sql statement,Update multiple records $comments = $commentsmodel->find("cid in(1,2,3,4,5,6,7,8,9)");

Database query is: Update Comments set del_status = 1,update_time =NOW_TIME,op_user = 'phlcon', op_uid =0 where cid in(1,2,3,4,5,6,7,8,9)

Error message:Wrong number of parameters Help