php - You must use the "set" method to update A Database Error Occurred

You must use the "set" method to update an entry.Filename: modules/unfollow/controllers/unfollow.phpLine Number: 251
// save logs
$this->db->insert($this->tb_logs, $logs);
updateLogsCounter('data_logs',$item->type,'up', $this->tb_accounts, $item->account_id);
updateLogsCounter('data',$item->type.'_tmp','up', $this->tb_schedule, $item->id);
// set time for next schedule
$data_update['status'] = 5;
$data_update['result'] = 'Successfully';
$rand_time = rand(5,30);
$data_update['time_post'] = date('Y-m-d H:i:s', strtotime(NOW) + $item->delay + $rand_time);
}
$this->db->where("ids", $item->ids);
**LINE 251-->>>** $this->db->update($this->tb_schedule, $data_update);
}
}
}
Answer
Solution:
Your Query should be working fine as you can pass the data as second parameter to update() but try
Changing this
$this->db->where("ids", $item->ids);
$this->db->update($this->tb_schedule, $data_update);
To
$this->db->set($data_update)->where("ids", $item->ids);
$this->db->update($this->tb_schedule);
and go through the documentation as well
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: can't write image data to path
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.