CodeIgniter Forums
Destructor and Database Connection - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived Development & Programming (
+--- Thread: Destructor and Database Connection (/showthread.php?tid=13643)

Destructor and Database Connection - El Forum - 12-01-2008

Hello there,

i'm new to codeigniter and currently developing my first project with it. I have implemented many own classes which have to interact with the database itself and have to read data in the Constructor and write them back in the Destructor.

The Problem is, that when the Destructor on my own class is called, the Database connection is already closed by CI and i have to manually reconnect or create a method which is called at the end of the code. This is not a very smooth way to code i think so my question is if there is any possibility to close the CI_DB later?

Wouldn't it be a nice feature if the classes are destructed from 'inside' to 'outside', so that all CI core functions are still accessible till the end?