0

When is it the best time to close a database connect? Is it good to close it on every scripting page i do that uses it?

5
Contributors
7
Replies
8
Views
6 Years
Discussion Span
Last Post by programmer12
0

When a PHP script is done executing all non-persistent connections will be closed.
Non-persistent connections are made with the _connect database functions so as long as you stick to that, there's nothing to worry about.

0

okay thanks!...

One more question what is a recursion? And how do i fix those? My website use to read "Out of memory on line 12"?

0

Error is based on coding and logic.
You have to increase your memory limit.
ini_set(’memory_limit’, '20M');

But if your script is in end level recursion, above solution wont work.
Make sure your recursive function has one limit and break somewhere.

0

okay, so the only thing I have to do is fix the PHP ini file to accept more memory?

0

When is it the best time to close a database connect? Is it good to close it on every scripting page i do that uses it?

I use a database singleton design pattern. That makes easy with single close throughout the session!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.