$this->load->database() in every control function |
[eluser]gnomixa[/eluser]
Is there a way to add it at the beginning of the application once? Calling this at the beginning of every function in the control file seems like a bad habit....also, does this create a new database connection? if so, when does it get closed? i am concerned about database optimization and don't want to create connection that just hang there. Please enlighten the CI newbie!
[eluser]pistolPete[/eluser]
Quote:Is there a way to add it at the beginning of the application once?Just have a look at the user guide: Automatically Connecting A database connection gets closed on script exit, but you can also force it quit, although there is no real need to do so: Code: $this->db->close();
[eluser]fesweb[/eluser]
If you are always using the same database, you should just save your database info once in your config/database file, and then autoload the database library in your config/autoload file. Code: // in config/autoload
|
Welcome Guest, Not a member yet? Register Sign In |