RE: Using a loop on a result destroys array??

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----Original Message-----
From: Mark Benson [mailto:markbenson@xxxxxxx] 

>The real problem you're having is the statement says "while there are 
>results in this query, grab them" - once you reach the end of the first

>while loop, there are no more results, so the second one is skipped 
>right over - it's condition *never* evaluates true.

So by running a "while (mysql_fetch_array($result)" loop over a fetch
array you effectively empty it?

<snip>

Well, not really - although in the end, yes, it will be 'empty' -
mysql_fetch_array actually fetches a single row (the next one, if
available) returned from the mysql query into an associative array.
You're being handed the data from mysql, one row at a time as requested,
and sticking it into an array.  $result is actually the resource id that
you give mysql so it knows what query to give you the information back
from.

- Martin Norland, Database / Web Developer, International Outreach x3257
The opinion(s) contained within this email do not necessarily represent
those of St. Jude Children's Research Hospital.

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



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux