Re: Closing Objects "Cleaning Up"

From: Date: Thu, 01 Feb 2001 23:19:00 +0000
Subject: Re: Closing Objects "Cleaning Up"
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-37750@lists.php.net to get a copy of this message
On Fri, 2 Feb 2001 08:58, Karl J. Stubsjoen wrote: > When I do this: > $link = @mysql_pconnect("localhost", $this->db_user_id, > $this->db_passwd); > > And I do this: > if(!($result = mysql_query($querystr))) { ... > > Then I do this: > $result = DoQuery($q); > > > What objects are there to close? In ASP we issue code like this to close > these objects: > rs.close > set rs = nothing > db.close > set db = nothing > (where rs is the recordset and db is the database) > > Thank You! You don't need to do anything - when the script terminates all that sort of thing is done for you by PHP. However, if you have a result set that may be using a bit of memory, and you have a lot more script after the result set is done with, you can use mysql_free_result. From TFM: mysql_free_result - Free result memory Description int mysql_free_result (int result) mysql_free_result() will free all memory associated with the result identifier result. mysql_free_result() only needs to be called if you are concerned about how much memory is being used for queries that return large result sets. All associated result memory is automatically freed at the end of the script's execution. For downward compatibility mysql_freeresult() can also be used. Cheers -- David Robley | WEBMASTER & Mail List Admin RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/ AusEinet | http://auseinet.flinders.edu.au/ Flinders University, ADELAIDE, SOUTH AUSTRALIA

« previous php.general (#37750) next »