if(count($br_code)>0){
$br_where = array();
foreach ($br_code as $code)
{
array_push($br_where, "asr_product_code LIKE '$code%'");
}
array_push($where,"(".implode(" OR ", $br_where).")");
}array_push($where,"(".implode(" OR ", $br_where).")"); 这行提示 
A PHP Error was encounteredSeverity: WarningMessage: array_push() expects parameter 1 to be array, null givenFilename: controllers/csv.phpLine Number: 109

解决方案 »

  1.   

    这错误提示似曾相识。。貌似是CodeIgniter框架?
    $where变量的处理请贴出来一起看看,这个提示的含义是$where变量没有被赋值过。如果没有处理过$where,应该进行初始化  $where = array();
      

  2.   

    他不是说的很清楚了吗? $where 不是一个数组
      

  3.   

    SELECT * FROM (
    SELECT ".(implode(',',$field))." 
    FROM {$this->table}  AS `a`
    LEFT OUTER JOIN `taobao_shujubao` AS `b` ON `a`.`asr_product_seq`=`b`.`fk_reseller_product_seq`
    ".(count($where) > 0 ? ' WHERE '.implode(' AND ',$where) : '')."
    {$this->order}
    {$this->limit}
    ) AS a 
    GROUP BY asr_product_seq该行的语句最后出来的是
    /* [models] - 60 */ SELECT * FROM ( SELECT `b`.`taobao_shujubao_data`,`b`.`taobao_shujubao_insert_time`,`b`.`taobao_shujubao_update_time` FROM asr_product AS `a` LEFT OUTER JOIN `taobao_shujubao` AS `b` ON `a`.`asr_product_seq`=`b`.`fk_reseller_product_seq` ORDER BY ORDER BY asr_product_code ASC, asr_product_seq DESC LIMIT 0, 1 ) AS a GROUP BY asr_product_seq 
    //////////////////////////////////////////////////
    A Database Error OccurredError Number: 1064You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ORDER BY asr_product_code ASC, asr_product_seq DESC LIMIT 0, 1 ) AS a ' at line 7
      

  4.   

    array_push是无法操作一个值为NULL的变量的,需要确保第一个参数是有效的数组。如果你希望一开始数组是空的,那应该进行初始化 $where = array();如果数组是经过查询而来,那应该检查SQL语句是否正确,很可能是查询失败。