Page 1 of 1

ADODB- MySQL and PHP - weird error message

Posted: Fri Jan 02, 2009 11:39 pm
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?

Re: ADODB- MySQL and PHP - weird error message

Posted: Sat Jan 03, 2009 12:43 am
by requinix
Messages seems a little weird. What exactly is $db? Is it a class or something from an extension?

Re: ADODB- MySQL and PHP - weird error message

Posted: Sat Jan 03, 2009 1:00 am
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");
}

Re: ADODB- MySQL and PHP - weird error message

Posted: Sat Jan 03, 2009 3:18 am
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?

Re: ADODB- MySQL and PHP - weird error message

Posted: Sat Jan 03, 2009 1:20 pm
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.

Re: ADODB- MySQL and PHP - weird error message

Posted: Sun Jan 04, 2009 3:42 am
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!