note 86769 added to pdostatement.fetchall
| From: | davey@php.net | Date: | Mon, 03 Nov 2008 02:54:35 +0000 |
| Subject: | note 86769 added to pdostatement.fetchall | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-146072@lists.php.net to get a copy of this message | ||
When passing PDO::FETCH_CLASS as the first argument, this method will accept the class name as the
second option:
<?php
$query = $pdo->prepare($sql);
$result = $query->execute($values);
if ($result && $query->rowCount() > 0) {
$records = $query->fetchAll(PDO::FETCH_CLASS, 'Some_Class');
// $record is now an array of Some_Class objects
}
?>
- Davey
----
Server IP: 208.69.120.35
Probable Submitter: 72.91.234.202
----
Manual Page -- http://www.php.net/manual/en/pdostatement.fetchall.php
Edit -- https://master.php.net/note/edit/86769
Del: integrated -- https://master.php.net/note/delete/86769/integrated
Del: useless -- https://master.php.net/note/delete/86769/useless
Del: bad code -- https://master.php.net/note/delete/86769/bad+code
Del: spam -- https://master.php.net/note/delete/86769/spam
Del: non-english -- https://master.php.net/note/delete/86769/non-english
Del: in docs -- https://master.php.net/note/delete/86769/in+docs
Del: other reasons-- https://master.php.net/note/delete/86769
Reject -- https://master.php.net/note/reject/86769
Search -- https://master.php.net/manage/user-notes.php