我在我的模型中有下面的函數,它返回一個數組數組。我想對每一行進行另一個操作,並在返回之前將結果添加到數據數組中。在數組上添加數據查詢結果
function get_all_annonce()
{
$this->db->select(" * from annonce");
$this->db->order_by("annonce.DATEDEBUTANNONCE","asc");
$q=$this->db->get();
if($q->num_rows()>0)
{
foreach($q->result() as $row)
{
$data[]=$row;
//I try to add another result
$experience=$this->get_experience($row->NUMUSER);
$data['experience']=$experience;
}
return $data;
}
}
但是我有一個錯誤,當我嘗試進入$experience
或$row->'experience'
在我看來。我該如何解決它?