Close connections on every page?
Moderator: General Moderators
Close connections on every page?
Should I mysql_close($dbh); on every page that I connect to my database on? Should I even close it on pages that use sessions? What is the effect?
Your database connections are automatically closed by PHP after execution of the script. So the only effect not closing them would have is that your connections would be open microseconds longer. Not really a security issue.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
This is a good advice but here is a little tip if you do it like this.feyd wrote:This is a security question?
It's not absolutely needed for the most part. However, if you're running into connection limit issues, it's best to add them immediately after the last database dependant call is made to make sure connections are open as short as possible.
If you edit your code sometime in the future you most likely forget that you did that. So make a mental note that if a database query does not work it is that the connection is closed. It took me some time to figure that out and that error drove me nuts before I did