Jump to content

Does die automatically terminate mySQL connections?


manmanman

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.