Undefined property in my view. How to output data in the view. - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Undefined property in my view. How to output data in the view. (/showthread.php?tid=2516) |
Undefined property in my view. How to output data in the view. - El Forum - 08-09-2007 [eluser]Henry Weismann[/eluser] I have just started with php MVC design pattern frameworks and after researching for a while I have decided to use CodeIgnitor. I have been using php for a few years now and have dabbled in OO techniques in other languages but it is still new to me. I am excited to learn a framework and work on application of OO ideas. Anyway I have what is probably a simple question. I have created a controller a model and a view but my view is giving an error when trying to output the results from my controller. This is the error: Code: Message: Undefined property: customerName I am using a foreach for iteration. Here are snippets of my code: The Model function: Code: function get_customers($limit,$offset) The controller function: Code: function customers($limit = 25, $offset = 0) In the view: Code: <ul> Can anyone tell me what I am doing wrong. Is $data['customer'] an array or object. Maybe I am missing my fundamentals on iterating through an object. Undefined property in my view. How to output data in the view. - El Forum - 08-09-2007 [eluser]Henry Weismann[/eluser] NEVERMIND I see my problem: I have get_producers mismatced with get_customers. This is waht happens when I copy and paste and then change things. Thanks anyway. That table field does not exist in that table. I guess posting something forces you to look at your code with a better eye. Undefined property in my view. How to output data in the view. - El Forum - 08-10-2007 [eluser]Phil Sturgeon[/eluser] At least you realised before someone posted back. I always realise my mistake a few mins after posting then as im writing my "dont worry, sorted it" i get spammed by 25 "z0mg yoo n00b!!1" replies. |