CodeIgniter Forums
How to use a database library in my own class - 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: How to use a database library in my own class (/showthread.php?tid=36043)



How to use a database library in my own class - El Forum - 11-19-2010

[eluser]Unknown[/eluser]
Plese help me. I write my own library and my class want to use a ci database library. But when I load this library with this code :
$CI =& get_instance();
$CI->load->library('database');

I have an error message :
Unable to load the request class : database

but when I test to load another library : example session.
I can use it. Can I resolve this problem.

I am a new ci user and my English skill is bad.


How to use a database library in my own class - El Forum - 11-19-2010

[eluser]Deveron[/eluser]
Hi,

the answer is: there is no database library.

but...

you can, if you like, load the database manually with:
Code:
$CI->load->database();

Please take a look at the User Guides for better understanding:
http://ellislab.com/codeigniter/user-guide/database/connecting.html

Cheers


How to use a database library in my own class - El Forum - 11-19-2010

[eluser]Unknown[/eluser]
Thank you very much. I can resolved this problem.