We love what we do and we’re good at it. Let us prove it to you.

CI框架MySQL一次更新多条记录

11 Nov

CI框架MySQL一次更新多条记录

    public function update($username, $cidList)
    {
        $data = [
            'status' => '1',
            'del_time' => date('Y-m-d H:i:s')
        ];
        foreach ($cidList as $cid) {
            $this->db->or_where('cid', $cid);
            $this->db->where('uid', $username);
        }
        $query = $this->db->update($this->contentTable, $data);
        return $query;
     }