Hi Marek It's print_r($row), not print_r($stmt) ;)
"Marek Kilimajer" <[EMAIL PROTECTED]> escreveu na mensagem news:[EMAIL PROTECTED] > Holografix wrote: >> Hi. When using this example from >> http://netevil.org/talks/index.php?t=pdo&s=20, the site of pdo's author I >> have this error: >> >> Fatal error: Call to a member function fetchAll() on a non-object in >> /www/home/testes/pdo_my1.php on line 17 >> >> >> $dbh = new PDO('mysql:host=localhost;dbname=dbtest', 'user', 'pass'); >> $stmt = $dbh->query("SELECT * FROM foo"); > > what does print_r($stmt); print here? > >> $rows = $stmt->fetchAll(); >> $count = count($rows); >> foreach ($rows as $row) { >> print_r($row); >> } >> $stmt = null; >> >> Wht's wrong with the example? >> >> Greetings >> holografix >> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php