Re: Freeing Memory
| From: | Nisse Engström | Date: | Fri, 31 Jul 2009 14:27:54 +0000 |
| Subject: | Re: Freeing Memory | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-296111@lists.php.net to get a copy of this message | ||
On Fri, 31 Jul 2009 07:54:13 -0400, Dan Shirah wrote:
>>
>> How does that work considering that mysql_query() only
>> returns true or false on INSERT? I'd expect the script
>> to fail on $result not being a valid resource.
>>
>
> I don't know about mysql as I work with MSSQL Server and Informix, but for
> me it works like this:
>
> $insert = ifx_prepare("INSERT INTO my_table
> VALUES ('0')", $connect_id);
> ifx_do($insert) or die ("Query failed");
> ifx_free_result($insert);
>
> By using PREPARE and DO to execute the queries it allows ifx_free_result to
> release those resources.
That explains it. (You'd have to use the MySQLi extension
to use prepared statements with MySQL, unless I'm confused).
Personally, I try to make it a point to free resources as
soon as possible.
/Nisse