如何在 Codeigniter 中使用 for 循环给出 where 条件
How to give where condition using for loop in Codeigniter
我有一个数组:
Array
(
[0] => 9055954
[1] => 2736738
[2] => 1234
[3] => 2844725
)
我需要一个 select id 表单数据库 table add_family 的 where 条件,其 id 不等于数组中的任何一个值,我正在使用 codeigniter ,如何使用 for 循环检查 where 条件。
您真的不需要 运行 for
循环来执行此操作。您可以通过 运行 一个简单的查询来简单地检查它,该查询将 select 来自 table 的所有记录在排除数组中指定的 ids
之后:
$ignore_ids = [9055954, 2736738, 1234, 2844725];
$this->db->where_not_in('add_family', $ignore_ids);
我有一个数组:
Array
(
[0] => 9055954
[1] => 2736738
[2] => 1234
[3] => 2844725
)
我需要一个 select id 表单数据库 table add_family 的 where 条件,其 id 不等于数组中的任何一个值,我正在使用 codeigniter ,如何使用 for 循环检查 where 条件。
您真的不需要 运行 for
循环来执行此操作。您可以通过 运行 一个简单的查询来简单地检查它,该查询将 select 来自 table 的所有记录在排除数组中指定的 ids
之后:
$ignore_ids = [9055954, 2736738, 1234, 2844725];
$this->db->where_not_in('add_family', $ignore_ids);