$this->db->where_in(); 的返回结果只有三列数据!
print_r($pid)的结果:----------------------------------------
Array
(
=> 212
=> 210
=> 53
=> 211
)
-----------------------------------------
这个是送进去查询用到的ID;
$this->db->where_in('pid',$pid);
返回的结果打印出来是这样的:
---------------------------------------------
Array
(
=> Array
(
=> 53
)
=> Array
(
=> 210
)
=> Array
(
=> 212
)
)
----------------------------------------------
有一行被CI给吃掉了,如何解决?
function _where_in($key = NULL, $values = NULL, $not = FALSE, $type = 'AND ')
{
if ($key === NULL OR ! is_array($values))
{
return;
}
$not = ($not) ? ' NOT ' : '';
foreach ($values as $value)
{
$this->ar_wherein[] = $this->escape($value);
}
$prefix = (count($this->ar_where) == 0) ? '' : $type;
$where_in = $prefix . $this->_protect_identifiers($key) . $not . " IN (" . implode(", ", $this->ar_wherein) . ") ";
$this->ar_where[] = $where_in;
if ($this->ar_caching === TRUE)
{
$this->ar_cache_where[] = $where_in;
}
// reset the array for multiple calls
$this->ar_wherein = array();
return $this;
}
SQL正常呢:
SELECT *
FROM (`table`)
WHERE `pid` IN ('212', '210', '53', '211') 哦~事实证明,我在navcat中运行该SQL,返回的结果的确只有三行。 。。。。。
CI 不可能会吃你的内容。。
你的思考方向就不对,呵呵 回复 5# Hex
SELECT * FROM (`table`) WHERE `pid` IN ('212', '210', '53', '211')
在命令行下也只有返回三行,我不知何故。 三行什么?
页:
[1]