That and maybe look into mysql_free_result() or mysql_freeresult()

Best,
Karl

Sent from losPhone

On Oct 27, 2011, at 9:08 PM, "Toby Hart Dyke" <t...@hartdyke.com> wrote:

> 
> 
> -----Original Message-----
> From: p...@umpquanet.com [mailto:p...@umpquanet.com] 
> Sent: Thursday, October 27, 2011 8:00 PM
> To: php-db@lists.php.net
> Subject: [PHP-DB] Simple MySQL sample code runs out of memory
> 
> Running PHP 5.3.5 on FreeBSD 8.2 connecting to a MySQL 5.1.55 server.
> 
> <snip>
>        $row = mysql_fetch_array( $result );
>        while ($row) {
> ...
> </snip>
> 
> Your while() condition will always be true, so that loop will run forever.
> Until you run out of memory.
> 
> What you probably meant was  to replace those two lines with something like
> this:
> 
>    while($row = mysql_fetch_array( $result ) ) {
> 
> A new row is fetched each time the while loop goes through another
> iteration, until you run out of rows and the condition evaluates to false.
> 
>  Toby
> 
> 
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to