0

I have an array:

Array
(
    [0] => 9055954
    [1] => 2736738
    [2] => 1234
    [3] => 2844725
)

I need to a where condition to select the ids form database table add_family whose id is not equal to any one of the value in array, I'm using codeigniter, how can I check it using for loop for where condition.

1
  • could you please give us more details, ex. your code where is a problem Commented Dec 22, 2016 at 8:19

1 Answer 1

0

You don't really need to run a for loop to do this. You can simply check it by running a simple query which will select all records from table after excluding ids as specified in array:

$ignore_ids = [9055954, 2736738, 1234, 2844725];

$this->db->where_not_in('add_family', $ignore_ids);
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.