note 83751 added to pdostatement.setfetchmode
| From: | harlequin2 at gmx dot de | Date: | Tue, 10 Jun 2008 12:22:24 +0000 |
| Subject: | note 83751 added to pdostatement.setfetchmode | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-140302@lists.php.net to get a copy of this message | ||
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";
}
?>
----
Server IP: 69.147.83.197
Probable Submitter: 195.145.235.171
----
Manual Page -- http://www.php.net/manual/en/pdostatement.setfetchmode.php
Edit -- https://master.php.net/note/edit/83751
Del: integrated -- https://master.php.net/note/delete/83751/integrated
Del: useless -- https://master.php.net/note/delete/83751/useless
Del: bad code -- https://master.php.net/note/delete/83751/bad+code
Del: spam -- https://master.php.net/note/delete/83751/spam
Del: non-english -- https://master.php.net/note/delete/83751/non-english
Del: in docs -- https://master.php.net/note/delete/83751/in+docs
Del: other reasons-- https://master.php.net/note/delete/83751
Reject -- https://master.php.net/note/reject/83751
Search -- https://master.php.net/manage/user-notes.php