|
|
|
Message: array_push() expects parameter 1 to be array, null given |
|
|
|
|
|
|
|
เอา code มาดูครับ
|
|
|
|
|
Date :
2012-05-26 19:40:44 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
$rs = $this->locate_model->like_data('locateName',$str);
foreach ($rs as $r){
$ar = array(
'idLocate' => $r['idLocate'],
'locatePro' => $r['locatePro'],
'locateCoun' => $r['locateCoun'],
'locateSubCoun' => $r['locateSubCoun'],
'locateName' => $r['locateName'],
'lat' => $r['lat'],
'lng' => $r['lng'],
'Member_mUser' => $r['Member_mUser'],
'comment_admin' => $r['comment_admin'],
'locateRate' => get_rate('Locate_idLocate', $r['idLocate'])
);
array_push($this->data['rs'],$ar);
}
|
|
|
|
|
Date :
2012-05-26 19:49:20 |
By :
supermang |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ลองเปลี่ยนชื่อแล้วครับไม่ได้เหมือนเดิม
|
|
|
|
|
Date :
2012-05-26 20:03:38 |
By :
supermang |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ก่อนจะ push มันจำเป็นต้องมีตัวก่อนหน้าหรือป่าวครับ
|
|
|
|
|
Date :
2012-05-26 20:06:54 |
By :
supermang |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
แก้ได้แล้วครับขอบคุณมันต้องให้ค่าก่อน
Code (PHP)
foreach ($rs as $r){
$ar = array(
'idLocate' => $r['idLocate'],
'locatePro' => $r['locatePro'],
'locateCoun' => $r['locateCoun'],
'locateSubCoun' => $r['locateSubCoun'],
'locateName' => $r['locateName'],
'lat' => $r['lat'],
'lng' => $r['lng'],
'Member_mUser' => $r['Member_mUser'],
'comment_admin' => $r['comment_admin'],
'locateRate' => get_rate('Locate_idLocate', $r['idLocate'])
);
if($this->data['rs'] == array()){ $this->data['rs'] = array($ar);}
else{ array_push($this->data['rs'],$ar);}
}
|
|
|
|
|
Date :
2012-05-26 20:16:35 |
By :
supermang |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 05
|