Jump to content

Does die automatically terminate mySQL connections?


Recommended Posts

1) I'm pretty sure all database connections terminate on the end of script execution. I believe mysql_close() is for if you want to close the connection before the script ends.

2) You could run a query every time somebody enters your site that will look like this: [code]$time = time()-(3600*24*48);
@mysql_query("DELETE FROM users WHERE activated=0 AND registration_date<{$time}");[/code]
If you use a non persistent connection to the MySQL database, you dont need to add mysql_close() before die or exit.

mysql_connect()  <-- non persitant connection
mysql_pconnect() <-- persistant connection

If you use a persistant connection then you will need to add mysql_close() [b]before[/b] die or exit to close your persistant connection.
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.