CodeIgniter Forums

Full Version: It's possible to connect to a DB but... closing a connection?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]punchi[/eluser]
It's possible?

In PHP, theres a mysql_connect and a mysql_close. Here we connect to a DB (dont know well which function is) but, there's no function to close a connection!!

It's possible (or make the connection null)? How?

Thanks!! =)

El Forum

[eluser]skunkbad[/eluser]
[quote author="punchi" date="1261381331"]It's possible?

In PHP, theres a mysql_connect and a mysql_close. Here we connect to a DB (dont know well which function is) but, there's no function to close a connection!!

It's possible (or make the connection null)? How?

Thanks!! =)[/quote]
Code:
$this->db->close();

El Forum

[eluser]punchi[/eluser]
lol... :red:

i don't saw it in the user guide... i though there was all the functions!!, and if there isnt all the functions, there's no API reference? :gulp:!

El Forum

[eluser]skunkbad[/eluser]
[quote author="punchi" date="1261390937"]lol... :red:

i don't saw it in the user guide... i though there was all the functions!!, and if there isnt all the functions, there's no API reference? :gulp:![/quote]

As far as I know, you are correct. I haven't seen this in the user guide. Unless you are using pconnect, you probably don't need to close the connection. Even w/ pconnect, I'm not sure if you need to close the connection.

El Forum

[eluser]punchi[/eluser]
If you'r using pconnect, you should close the connection. For a no-pconnect, it's necessary for big querys, because anyway at the end of the script PHP will close connections.

And, is better to have a connection "null" than closing it, at least that appear in discussions in PHP (both ways finish the connection, but closing it can close a TCP layer, giving problems)

So, i'll try the
Code:
$this->db = null;
idea, maybe that line give me an error, but well, I'll try something like that.

Thanks skunkbad! always helping (at least) to me =)