note 15047 deleted from function.mysql-fetch-assoc by philip
| From: | philip@php.net | Date: | Fri, 02 Nov 2001 18:10:34 +0000 |
| Subject: | note 15047 deleted from function.mysql-fetch-assoc by philip | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-20312@lists.php.net to get a copy of this message | ||
If you needed to access the entire table as a 2d array, use this to stuff the output into a numeric
array.
$tableArray = array();
while($tableLine = mysql_fetch_assoc($tableResult)) {
$tmpTableArray = array($tableLine)
//Stuff $tableLine into a numerical array
$tableArray = array_merge($tableArray, $tmpTableArray);
}
Now, if you wanted to print column "name" from row 5, you'd use this:
echo $tableArray[5]["name"];
If you wanted it as a numerical column index, subsitute mysql_fetch_assoc for mysql_fetch_row.