note 15047 added to function.mysql-fetch-assoc.php

From: Date: Sat, 25 Aug 2001 18:35:40 +0000
Subject: note 15047 added to function.mysql-fetch-assoc.php
Groups: php.notes 
Request: Send a blank email to php-notes+get-17135@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. http://www.php.net/manual/en/function.mysql-fetch-assoc.php

« previous php.notes (#17135) next »