Codeigniter Message: Undefined variable: infos why cant I connect the abouts table? - 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: Codeigniter Message: Undefined variable: infos why cant I connect the abouts table? (/showthread.php?tid=53715) Pages:
1
2
|
Codeigniter Message: Undefined variable: infos why cant I connect the abouts table? - El Forum - 08-05-2012 [eluser]ytsejam[/eluser] Hello , I am a novice coder and trying to learn about CI. Now mysite works in the homepage. Site opens , navigation and content splits into both sites. I can use ajax. I use MY_Controller.php : Code: function render_page($view) { Code: public function view($page = 'home') works and I can get the services-table from the database. and I can use it in the view file as : Code: <ul class="blog-medium"> But when i click about page I cant get the about table . It gives me undefined variable infos. about controller : Code: public function view($page = 'about') and my about view : Code: <?php foreach($infos as $row): ?> Codeigniter Message: Undefined variable: infos why cant I connect the abouts table? - El Forum - 08-05-2012 [eluser]TWP Marketing[/eluser] What are the specific errors? Codeigniter Message: Undefined variable: infos why cant I connect the abouts table? - El Forum - 08-05-2012 [eluser]ytsejam[/eluser] A PHP Error was encountered Severity: Notice Message: Undefined variable: infos Filename: pages/about.php Line Number: 3 A PHP Error was encountered Severity: Warning Message: Invalid argument supplied for foreach() Filename: pages/about.php Line Number: 3 Codeigniter Message: Undefined variable: infos why cant I connect the abouts table? - El Forum - 08-05-2012 [eluser]theprodigy[/eluser] You are trying to pass in your $data array Code: $this->render_page('pages/'.$page,$data); but your render_page function doesn't accept a second parameter Code: function render_page($view) { Codeigniter Message: Undefined variable: infos why cant I connect the abouts table? - El Forum - 08-05-2012 [eluser]ytsejam[/eluser] My home.php view works without any problem .Why is there a problem in about php.? Codeigniter Message: Undefined variable: infos why cant I connect the abouts table? - El Forum - 08-05-2012 [eluser]theprodigy[/eluser] Your home controller is setting $this->data, not $data Code: $this->data['records']= $this->services_model->getAll(); Codeigniter Message: Undefined variable: infos why cant I connect the abouts table? - El Forum - 08-05-2012 [eluser]ytsejam[/eluser] Cant it be because there is only one file for the abouts table?I mean there is only one insert for that table? Codeigniter Message: Undefined variable: infos why cant I connect the abouts table? - El Forum - 08-05-2012 [eluser]theprodigy[/eluser] I think it has to do with the about page not setting $this->data. Codeigniter Message: Undefined variable: infos why cant I connect the abouts table? - El Forum - 08-05-2012 [eluser]ytsejam[/eluser] My new code is here : Code: public function view($page = 'about') Codeigniter Message: Undefined variable: infos why cant I connect the abouts table? - El Forum - 08-05-2012 [eluser]theprodigy[/eluser] what is in your about_model->getAll function? |