is it necessary to use mysql_close() at the end of a query in PHP?
4 Answers
In the manual :
mysql_close() closes the non-persistent connection to the MySQL server that's associated with the specified link identifier.
Using mysql_close() isn't usually necessary, as non-persistent open links are automatically closed at the end of the script's execution.
More reading about that here
1 Comment
preinheimer
Terminating resources as soon as they're no longer required is always a good practice. If your script is long running holding on to resource you no longer need just brings you closer to resource exhaustion.
Using mysql_close() isn't usually necessary, as non-persistent open links are automatically closed at the end of the script's execution. See also freeing resources.
read more at :
1 Comment
Adeel
Performance can be improved by closing as soon as you are done so the handle is available for other processes to use.