You are here: Re: PDOStatement error : Call to a member function execute() on a non-object « PHP Programming Language « IT news, forums, messages
Re: PDOStatement error : Call to a member function execute() on a non-object

Posted by loudwinston@gmail.com on 11/15/06 19:57

I added a print_r of $db->errorInfo() before the execute statement and
get the following

Array
(
[0] => 00000
[1] => 1047
[2] => Unknown command
)



On Nov 15, 2:38 pm, Michael Fesser <neti...@gmx.de> wrote:
> .oO(loudwins...@gmail.com)
>
> ><?
> >$db_dsn = "mysql:host=dbHost;dbname=dbName";
> >$db_username = "username";
> >$db_password = "password";
> >$db = new PDO($db_dsn, $db_username, $db_password);
> >$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
> >$statement = $db->prepare("SELECT * FROM myTable");
> >$statement->execute();
> >?>
>
> >I get an error on the last line "Fatal error: Call to a member function
> >execute() on a non-object"There's no error handling.
>
> PDO::prepare() returns FALSE if something goes wrong.
> Then check PDO::errorInfo() to get more informations.
>
> Micha

 

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

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