note 83751 deleted from pdostatement.setfetchmode by googleguy

From: Date: Tue, 22 Oct 2013 11:01:06 +0000
Subject: note 83751 deleted from pdostatement.setfetchmode by googleguy
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-197019@lists.php.net to get a copy of this message
Note Submitter: harlequin2 at gmx dot de ---- You can also set the fetch mode to FETCH_ASSOC if you do not need the column index. This reduces both the size of the resultset and is faster in some cases. <?php $stmt = $dbh->prepare("SELECT mykey, myvalue FROM mytable"); $stmt->setFetchMode(PDO::FETCH_ASSOC); $arrValues = $stmt->fetchAll(); foreach ($arrValues as $row){ print $row["mykey"]." -> ".$row["myvalue"]."<br />\n"; } ?>

« previous php.notes (#197019) next »