在下面的代碼中,我有錯誤,如何解決?提供的參數無效
我在表中的數據是:
是CI_Controller:
$update = array('15'); // this is a example from my $_POST that are array.
if (is_array($update) && count($update) > 0) {
foreach($update as $val){
$data['query_hi'] = $this->db->get_where('hotel_image', array('relation' => $val))->row();
}
$this -> load -> view('admin/residence_update', $data);
}
查看:
foreach($query_hi->images as $val){
echo $val;
}
錯誤:
A PHP Error was encountered
Severity: Warning
Message: Invalid argument supplied for foreach()
Filename: core/Loader.php(679) : eval()'d code
Line Number: 279
在加載視圖並將輸出添加到您的問題之前,執行'var_dump($ data ['query_hi']);''。 – hakre