You are here: Re: [PHP] PDO Error « PHP « IT news, forums, messages
Re: [PHP] PDO Error

Posted by Marek Kilimajer on 10/21/53 11:21

Holografix wrote:
> Hi Marek
>
> It's print_r($row), not print_r($stmt) ;)

That's what I'm asking - If you put print_r($stmt) in that line, what
does it print?

>
>
>
> "Marek Kilimajer" <lists@kilimajer.net> escreveu na mensagem
> news:42D75E0F.8020203@kilimajer.net...
>
>>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
>>>
>
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация