
Originally Posted by
crmalibu
The mysql driver for PDO supports this through the fetchAll() method, but if not using PDO
PHP Code:
$arr = array();
while ($row = mysql_fetch_row($result)) {
$arr[] = $row;
}
Also see mysql_fetch_assoc() and mysql_fetch_array(), if you want associative keys, or both.
This is what I thought would work...but when I want to echo the results, I use this code, and get the result below it:
Code:
echo "$arr[0] <br />";
echo "$arr[1] <br />";
echo "$arr[2] <br />";
echo "$arr[3] <br />";
Array
Array
Array
Array
If I can get the results into an array of arrays, I would think I could echo it like this and it would pretty much display the entire table, one field at a time, in a long list:
Code:
echo "$arr[0][0] <br />";
echo "$arr[0][1] <br />";
echo "$arr[0][2] <br />";
echo "$arr[0][3] <br /><br />";
echo "$arr[1][0] <br />";
echo "$arr[1][1] <br />";
echo "$arr[1][2] <br />";
echo "$arr[1][3] <br /><br />";
etc.
Thx again...arrays have been the toughest thing to get comfortable with in PHP!
Bookmarks