Page 2 of 2

Posted: Sun Jul 24, 2005 11:31 pm
by stukov
No. As I said before, mysql_fetch_array will only extract you one row of your result (resource) and put it into an array. If you want to store all of them, walk trough your result set with a while loop with something like this :

Code: Select all

while ($row = mysql_fetch_assoc($result)) {
   echo $rowї&quote;userid&quote;];
   echo $rowї&quote;fullname&quote;];
   echo $rowї&quote;userstatus&quote;];
}
So, by doing :

Code: Select all

$array = mysql_fetch_array($query);
you will get only the first row MySQL returned you. If you want to pick the 83rd row, you will have to use mysql_data_seek(). It will move the internal row pointer to the row you want to select. Then, by calling mysql_fetch_array() you will select this row.

Manual page: http://ca3.php.net/manual/en/function.m ... a-seek.php

By the way, mysql_fetch_row, mysql_fetch_array and mysql_fetch_array work pretty the same. Only the way you store the return value changes.