ADODB- MySQL and PHP - weird error message

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bonesbrigade
Forum Newbie
Posts: 5
Joined: Fri Jan 02, 2009 11:36 pm
Location: Los Angeles, CA - USA

ADODB- MySQL and PHP - weird error message

Post by bonesbrigade »

I am using ADODB for the first time with PHP and MySQL, and I keep getting a weird error that doesn't really tell me what the problem is.

The error is:
Fatal error: mysql error: [: ] in EXECUTE("SELECT * FROM packages") in /home/... /include/adodb/adodb-errorhandler.inc.php on line 77

and the code that causes that error:

Code: Select all

$rs = $DB->Execute("SELECT * FROM $PackageTableName");
Any insight would be wonderful. I tried searching around Google for ADODB errors but couldn't find this one (it's a [: ] ?). Perhaps I am not using ADODB correctly?
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: ADODB- MySQL and PHP - weird error message

Post by requinix »

Messages seems a little weird. What exactly is $db? Is it a class or something from an extension?
bonesbrigade
Forum Newbie
Posts: 5
Joined: Fri Jan 02, 2009 11:36 pm
Location: Los Angeles, CA - USA

Re: ADODB- MySQL and PHP - weird error message

Post by bonesbrigade »

$DB refers to the database connection, used through the ADODB classes.

Code: Select all

if (empty($DB)){
    $DB= &ADONewConnection("$DBDriver");
    $DB->PConnect("$HostName","$UserName","$DBPassword","$DBName");
}
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: ADODB- MySQL and PHP - weird error message

Post by requinix »

Set $DB->debug = true, apparently it will "output lots of useful status and error messages".

You set $database, $host, $user, and $password in the main class, right?
bonesbrigade
Forum Newbie
Posts: 5
Joined: Fri Jan 02, 2009 11:36 pm
Location: Los Angeles, CA - USA

Re: ADODB- MySQL and PHP - weird error message

Post by bonesbrigade »

Ok I will try the Debug setting. And yes the hostname, username, pw, and dbname are all set in an included config file.

The weird thing is that before that line of code runs, I am using adodb to create, insert, truncate, and EVEN select. It just all seems strange that it stops right there. Hopefully the debug will turn up some answers.
bonesbrigade
Forum Newbie
Posts: 5
Joined: Fri Jan 02, 2009 11:36 pm
Location: Los Angeles, CA - USA

Re: ADODB- MySQL and PHP - weird error message

Post by bonesbrigade »

Heh, I guess I wasn't paying attention- I had a close() statement after one of my functions, and the connection to the database was closed.

The debug=true thing helped me find this out. Thanks tasairis!
Post Reply