note 56031 rejected from function.pdostatement-fetchall by mazzanet

From: Date: Sun, 21 Aug 2005 10:13:53 +0000
Subject: note 56031 rejected from function.pdostatement-fetchall by mazzanet
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-93983@lists.php.net to get a copy of this message
Note Submitter: f dot kowal at wp dot pl ---- it could be usefull if one could specify a parameter, telling what is to be the index of the return array something like: $sth = $dbh->prepare("SELECT id_fruit, name, colour FROM fruit"); $sth->execute(); /* Fetch all of the remaining rows in the result set */ print("Fetch all of the remaining rows in the result set:\n"); $result = $sth->fetchAll('id_fruit'); print_r($result); and the result would be like: Array ( [115] => Array ( [id_fruit] => 115 [0] => 115 [NAME] => pear [1] => pear [COLOUR] => green [2] => green ) [44] => Array ( [id_fruit] => 44 [0] => 44 [NAME] => watermelon [1] => watermelon [COLOUR] => pink [2] => pink ) ) ofcourse if the table_index would not be specified the result array elements would be assigned auto incremented values

« previous php.notes (#93983) next »