1

I have an array like so:

Array ( [0] => 6599 [1] => 6600 ) 

This array, will be much larger in a live scenario.

I need to update my database table rows which have the entry_id(s) in this array, updating just one column status, with the value open.

I had thought I could use update_batch (https://www.codeigniter.com/userguide2/database/active_record.html#update, but I couldn't get it to work.

How can I achieve this?

1 Answer 1

3

You can use where_in method

$ids = Array(12,34,55,677,123);
$this->db->where_in('id', $ids);
$this->db->update('table', array('status' => 'open'));
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.