PDO error
| From: | Holografix | Date: | Fri, 15 Jul 2005 10:45:42 +0000 |
| Subject: | PDO error | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-39951@lists.php.net to get a copy of this message | ||
Hi. When using this example from
http://netevil.org/talks/index.php?t=pdo&s=20,
the site of pdo's author Wez
Furlong, I
get this error:
Fatal error: Call to a member function fetchAll() on a non-object in
/www/home/testes/pdo_my1.php on line 8
<?php
....
....
$dbh = new PDO('mysql:host=localhost;dbname=dbtest', 'user', 'pass');
$stmt = $dbh->query("SELECT * FROM foo");
$rows = $stmt->fetchAll();
$count = count($rows);
foreach ($rows as $row) {
print_r($row);
}
$stmt = null;
?>
What's wrong with the example?
I'm using php 5.1.0-dev, yesterday snapshot.
Greetings