|
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]
|