Jump to content

mysql_close


astralaaron

Recommended Posts

I have been viewing a lot of other peoples php codes on this site for months.. I do not see the mysql_close() being used? when is a situation where you would close mysql? doesnt mysql close when the page is left?
mysql_close() php function is used to close the database server connection, it is like when you assign something to a variable and then empty this variable so that you free the memory resources ( because any variable you open, takes a place in the memory )... I suggest that you close everything you start, it is like a better programming practice...
Link to comment
Share on other sites

mysql_close() php function is used to close the database server connection, it is like when you assign something to a variable and then empty this variable so that you free the memory resources ( because any variable you open, takes a place in the memory )... I suggest that you close everything you start, it is like a better programming practice...
I understand.. how do you close a variable?
Link to comment
Share on other sites

mysql_close() php function is used to close the database server connection, it is like when you assign something to a variable and then empty this variable so that you free the memory resources ( because any variable you open, takes a place in the memory )... I suggest that you close everything you start, it is like a better programming practice...
I understand.. how do you close a variable?
Link to comment
Share on other sites

I understand.. how do you close a variable?
I don't know how to close a normal variable in php... but - for example - in ASP it is done by setting your variable_name equal to nothing ex :
<%Dim name''the use of the variable...'set name = nothing%>

Link to comment
Share on other sites

PHP performs a garbage collection at the end of execution on every script - destroys all the objects and variables not being used, so there is no need to destroy/close the variables manually.The same thing goes with mysql connections

Using mysql_close() isn't usually necessary, as non-persistent open links are automatically closed at the end of the script's execution.
http://www.php.net/mysql_closeIf you really want to destroy variables manually use unset()
Link to comment
Share on other sites

mysql_close() is only really useful when you connect to multiple database servers.

Link to comment
Share on other sites

  • 2 weeks later...

Archived

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

×
×
  • Create New...