Array question

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

 



I have the following code:

$query = "SELECT * FROM classics";
$result = mysql_query($query);

if (!$result) die ("Database access failed: " . mysql_error());
$rows = mysql_num_rows($result);

for ($j = 0 ; $j < $rows ; ++$j)
{
    $results[] = mysql_fetch_array($result);
}

mysql_close($db_server);

My question, in the loop, why does tha author use:

$results[] = mysql_fetch_array($result);

instead of (as I would expect):

$results[$j] = mysql_fetch_array($result);?

What PHP magic is at work here?

Thanks.


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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux