CodeIgniter Forums
connecting and retrieving database data - 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: connecting and retrieving database data (/showthread.php?tid=32896)



connecting and retrieving database data - El Forum - 08-09-2010

[eluser]Unknown[/eluser]
hey everyone.i still can't get through in connecting and retrieving data from my database.
1)in my database.php config file,i configured the db name,username set to root and active group allowed as default (for now).
2)in the welcome.php controller file i loaded the db with:$this->load->database('default');
3)finally in my view page where i wish to display the db data,i typed:

<?


connecting and retrieving database data - El Forum - 08-09-2010

[eluser]Ajaxian64[/eluser]
try $this->load->database(); in your controller; You should do it in constructor, after parent::Controller();
Otherwise you can do this in autoload $autoload['libraries'] = array('database','xxx');


connecting and retrieving database data - El Forum - 08-09-2010

[eluser]mddd[/eluser]
Topic starter has continued here

@ndijones: Don't start multiple threads on the same issue please. That makes it hard for people to help you.