pdo fetchall including id code example
Example: 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
?>
<?php
$sth = $dbh->prepare("SELECT name, colour FROM fruit");
$sth->execute();
$result = $q->fetchAll(PDO::FETCH_OBJ);
//$result contains an array of stdObjects
?>