Re: Mysql_free_result() doubt
| From: | Richard Lynch | Date: | Tue, 26 Sep 2006 21:57:18 +0000 |
| Subject: | Re: Mysql_free_result() doubt | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-242239@lists.php.net to get a copy of this message | ||
On Tue, September 26, 2006 8:44 am, suresh kumar wrote:
> I am little bit confused to use the
> mysql_free_result($result) function.because i searched
> google - they told dont use this function to php 4.X
> and also it says clearly "When you are done with a
> result set, you must free the memory it uses by calling
> mysql_free_result()".
>
> I mean something like when to use or not to use it? I
> already know that only SELECT queries that retrieve
> rows require to free resources, but maybe when all data
> is retrieved the resources are free automatically or we
> need to call mysql_free_result() to free the memory. and
> also this function will free only one row at a time or
> all the rows of the result set .
PHP is going to free the data when your script ends, so most common
uses of MySQL don't even need mysql_free_result, as your page doesn't
do anything after it's done with MySQL anyway.
In some scripts, you are "done" with a large result set, and can gain
some performance by releasing all the resources tied to that result
set.
The argument to mysql_free_result is a result resource, and it frees
ALL the records, as you call it, and any other resources that result
set is using.
--
Like Music?
http://l-i-e.com/artists.htm