http://sg.php.net/manual/en/pdostatement.fetchall.php
Correct usage as dictated:
<?php
$sth = $dbh->prepare("SELECT name, colour FROM fruit");
$sth->execute();
/* Fetch all of the remaining rows in the result set */
print("Fetch all of the remaining rows in the result set:\n");
$result = $sth->fetchAll();
print_r($result);
1
solved Calling to a non-object, where actually is an object [closed]