We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 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";
        } else
            echo "1";

What's the problem?


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