Database results will not display. New to CI - 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: Database results will not display. New to CI (/showthread.php?tid=18095) Pages:
1
2
|
Database results will not display. New to CI - El Forum - 04-26-2009 [eluser]Dam1an[/eluser] What do you get when you use print_r on the query Try both the following Code: $query = $this->db->get('questions'); Database results will not display. New to CI - El Forum - 04-27-2009 [eluser]Nicholas Hanks[/eluser] I think problem is in your DB config file password is missing!!!!! for root user. Database results will not display. New to CI - El Forum - 04-27-2009 [eluser]Dam1an[/eluser] [quote author="Nicholas Hanks" date="1240875575"]I think problem is in your DB config file password is missing!!!!! for root user.[/quote] Thats normal assuming he's using XAMPP/WAMP/MAMP etc as they all have the root with no password, they aim to be as open as possible for development, not secure for a production system Database results will not display. New to CI - El Forum - 04-27-2009 [eluser]Mark Skilbeck[/eluser] Shouldn't it be: Code: $data['questions'] = $this->db->get('questions'); Code: foreach($questions->result() as $question) Database results will not display. New to CI - El Forum - 04-27-2009 [eluser]Zeeshan Rasool[/eluser] Here , two situations arrive , When you are using like this in controller. You're getting record directly in controller such as.. Code: 1- $data['questions'] = $this->db->get('questions'); Then record will be accessed in the view with this : Code: foreach($questions->result() as $rec){echo $rec->name;}?> in controller: Code: 2- $data['questions'] = $this->model_name->func_name(); Code: func_name() Code: foreach($questions as $rec) Hope it will help. Cheers |