associative arrays

From: Date: Thu, 10 Jul 2003 22:09:56 +0000
Subject: associative arrays
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-6557@lists.php.net to get a copy of this message
Hey all- Could someone give an example of how to use the DB_Common::getAssoc() function? I'm trying to get an table into an array, and var_dump() shows that the array is not associative. Here's the code: $sql = "select * from sr_names"; $table = $db->getAssoc($sql); echo var_dump($table); And here's the output: array(1) { [1]=> array(16) { [0]=> string(5) "Jacob" [1]=> string(6) "Marble" [2]=> NULL <etc...> As I understand it, an associative array should return something more like: array(1) { [1]=> array(16) { ['firstname']=> string(5) "Jacob" ['lastname']=> string(6) "Marble" ['email']=> NULL <etc...> Or am I showing of my newness... ;-) Any help greatly appreciated!! Jake LandEZ

« previous php.pear.general (#6557) next »