【发布时间】:2015-03-13 04:56:52
【问题描述】:
我正在使用 codeigniter 活动记录查询条件。
<?php
foreach($std->result() as $stds_id) {
$stid[] = $stds_id->std_id;
print_r($stid);
}
实际上我想传递的是 where_in 是 Array ( [0] => 1 ) Array ( [0] => 2 [1] => 4 )
但它打印出来像
Array ( [0] => 1 ) Array ( [0] => 1 [1] => 2 ) Array ( [0] => 1 [1] => 2 [2] => 4 )
我不知道如何通过它。
我的模特:
$this->db->select('*');
$this->db->where_in($field,$id);
$getdata=$this->db->get($table);
return $getdata;
【问题讨论】:
-
您的查询没问题,
$stid也没问题。只需在foreach循环外打印即可。只需在foreach循环后调用模型函数
标签: php mysql sql codeigniter