manmanman Posted September 18, 2006 Share Posted September 18, 2006 Does die automatically terminate mySQL connections? Also, how can I run operations, such as delete unactivated users 48 hours after registration, without using a cron job? Link to comment https://forums.phpfreaks.com/topic/21121-does-die-automatically-terminate-mysql-connections/ Share on other sites More sharing options...
Daniel0 Posted September 18, 2006 Share Posted September 18, 2006 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] Link to comment https://forums.phpfreaks.com/topic/21121-does-die-automatically-terminate-mysql-connections/#findComment-93818 Share on other sites More sharing options...
wildteen88 Posted September 18, 2006 Share Posted September 18, 2006 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 connectionmysql_pconnect() <-- persistant connectionIf you use a persistant connection then you will need to add mysql_close() [b]before[/b] die or exit to close your persistant connection. Link to comment https://forums.phpfreaks.com/topic/21121-does-die-automatically-terminate-mysql-connections/#findComment-93968 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.