Reply to PDOStatement error : Call to a member function execute() on a non-object

Your name:

Reply:


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

Hello,

I'm encountering a strange error with PDO. The server is FreeBSD 4.4,
PHP 5.1.2, mySQL 4.0.20 with 4.1.18 client libs.

I have the following code (usernames and passwords changed to protected
the innocent ^_^)

<?
$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"

What's strange is this code works fine on my development servers, and
used to work fine on this server up until a few days ago. I've
restarted the server several times, recompiled php with the following
configure script

../configure --with-pdo-mysql=/usr/local/mysql --with-curl=/usr/local
--enable-versioning --enable-memory-limit --with-layout=GNU
--enable-ctype --enable-overload --enable-posix --enable-session
--enable-tokenizer --with-expat-dir=/usr/local --with-imap=/usr/local
--with-jpeg-dir=/usr/local --with-mysql=/usr/local/mysql
--with-pcre-regex=yes --with-png-dir=/usr/local --with-zlib-dir=/usr
--with-zlib=yes --with-regex=php --enable-cli
--with-apxs2=/usr/local/www/bin/apxs --prefix=/usr/local
i386--freebsd4.4 --enable-spl --with-pdo --enable-pdo
--with-gd=/usr/local --disable-all

This is the only script that gets run so there's definitely no problems
with open cursors (I've read the posts about
PDOStatement::closeCursor()).

The only thing I can think of is that the 4.1.18 mySQL client libs wont
work with PDO and mySQL 4.0.20. I've tested with old-school mysql
functions (mysql_connect) and it works fine, its only PDO that breaks.

Does anyone have any idea? Thanks so much for any help.

~Kevin

[Back to original 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

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