Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

pdo fetchall as object

 <?php
 $sth = $dbh->prepare("SELECT name, colour FROM fruit");
 $sth->execute();

 $result = $q->fetchAll(PDO::FETCH_OBJ);
 //$result contains an array of stdObjects
 ?>
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #pdo #fetchall #object
ADD COMMENT
Topic
Name
9+4 =