CodeIgniter Forums
Undefined Offset:0 under Helper - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Undefined Offset:0 under Helper (/showthread.php?tid=542)



Undefined Offset:0 under Helper - elimariaaaa - 12-15-2014

I am encountering an Error:
A PHP Error was encountered
Severity: Notice
Message: Undefined offset: 0
Filename: helpers/ompty_helper.php
Line Number: 9


Here's line Numer 9: "$resto_web_apps_info = $resto_web_apps_info[0]->$structure;"

The model contains:
function get_resto_web_apps_info($general_id, $web_app_name, $structure){
return $this->db->select('rwi.'.$structure)
->from('restaurant_web_apps_info as rwi')
->join('restaurant_web_apps as r', 'r.id = rwi.restaurant_web_apps_id', 'left outer')
->where('r.web_app_name', $web_app_name)
->where('rwi.general_restaurant_info_id', $general_id)
->get()
->result();
}



I've been calling this function multiple times but I get this only in one part of my code. What could be the possible problem?


RE: Undefined Offset:0 under Helper - Rufnex - 12-16-2014

Can you post your helper code .. this error says, that in $resto_web_apps_info[0] is nothing, so you have to check first if your array has a value.


RE: Undefined Offset:0 under Helper - tronbow - 12-16-2014

just try result_array() in your model