![]() |
Need Help ....... - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Need Help ....... (/showthread.php?tid=57766) |
Need Help ....... - El Forum - 04-09-2013 [eluser]Unknown[/eluser] Hi, I have downloaded the "CodeIgniter_2.1.3", but I am not finding the file containing the class (CI_DB)for database connectivity which is supposed to be under folder "application/libraries". Can anybody help me on this... it is urgent......:-S Need Help ....... - El Forum - 04-09-2013 [eluser]CroNiX[/eluser] That is a core class with it's own driver, located in /system/database Anything in /application would be your own application specific things, like your controllers, configs, libraries, models, etc., not the CORE CI classes. Need Help ....... - El Forum - 04-10-2013 [eluser]Unknown[/eluser] Hi CroNiX, then how to load the database connectivity class. Every sample code is telling to load the database class in "autoload.php" using code $autoload['libraries'] = array('database','session'); then use the following to connect to DB $this->load->database('proj'); Please correct me if I am wrong. Please if possible send some sample code for the same. It is urgent ...... Need Help ....... - El Forum - 04-10-2013 [eluser]Ckirk[/eluser] If you look at your config file "application/config/database.php" by default you will see the variable: Code: $active_group = 'default'; Code: $db['default']['hostname'] = 'localhost'; You've set 'database' to load in your autoload so your CI application will automatically do: Code: $this->db->load('default') When you use $this->db->load() with no input parameter it uses the group as defined by the $active_group variable (which is what the autoload will handle). You're asking it to override that variable and load the database group called 'proj' so you must have that in your config file, otherwise it will fail. If 'proj' is the only database group you'll ever connect to then just set Code: $active_group = 'proj'; Code: $db['default']['hostname'] = 'localhost'; |