RE: FN-FORUM: [PHP] Why?
date posted 26th January 2005 17:32
> -----Original Message-----
> From: Dom Latter [EMAIL REMOVED]
>
> Fronm a site I maintain, but did not develop:
>
> while( $data = mysql_fetch_array( $result ) ) {
> $details[] = $data;
> }
>
> If you're wondering, $details is unset up to this point.
>
It loads the rows from the db into the array $details ($details[] will
append to the next empty array member so equivalent to
$details[count($details)]). As to why, it depends what it does with
them later, it may be because the code needs to do 'random access'
rather than sequential access on the data and while that is supported
diretcly with recordsets using mysql_result(), doing it directly on an
array will almost certainy be quicker.
HTH,
Dai
TechnologyAngel
http://www.technologyangel.co.uk/