MDB2 Syntax Error

corewerx

New Member
Messages
2
Reaction score
0
Points
0
Anyone want to take a stab at telling me where the syntax error is in this block of code:

PHP:
$dbtable = 'cw_users';
$dbfields = array ('text', 'text', 'text', 'text', 'date', 'date', 'integer', 'text', 'integer', 'integer');
$dbdata = array('user_name' => $username, 'user_password' => $password, 'user_key' => $userkey, 'user_region' => $region, 'user_born' => $birthdate, 'user_register' => $regdate, 'user_balance' => 0, 'user_theme' => 'Default', 'user_level' => 1, 'user_status' => 1);

$affectedRows = $mdb2->extended->autoExecute($dbtable, $dbdata, MDB2_AUTOQUERY_INSERT, null, $dbfields);

if (PEAR::isError($affectedRows)) {
    die($affectedRows->getMessage());
}

In addition ot the basic MDB2 library with the MySQL driver, I have both the manager and extended modules loaded and tested... But now, testing my first insert into my DB is not working... I keep getting the following from my test app:

Production Core Werx Registration Pass Senard (260352, 290304) Damian McLeod 73de2b24-ede6-4f70-a518-b5748489c897 cc8424e6f5473a32e644b3aa8292849b471dc506 2006-10-12 2008-04-06MDB2 Error: syntax error

The code that generates everything up to the MDB2 / PHP code posted above has been tested six ways from Sunday and then some, by four different developers, but alas, I am the only one working on the actual DB code, as the PHP side of the app is my domain... Somewhere along the MDB2 calls are throwing a syntax error and I have double checked everything against the PEAR Manual pages for MDB2, and a couple of other reference sites... Any ideas that you may have as to the glitch are welcome...

EDIT:

PHP:
$affectedRows = $mdb2->extended->autoExecute($dbtable, $dbdata, MDB2_AUTOQUERY_INSERT, null, $dbfields);

Further testing has revealed this line to be the culprit but I don't see any errors in it... Thoughts?
 
Last edited:

adamssida

New Member
Messages
1
Reaction score
0
Points
0
Anyone want to take a stab at telling me where the syntax error is in this block of code:

EDIT:

PHP:
$affectedRows = $mdb2->extended->autoExecute($dbtable, $dbdata, MDB2_AUTOQUERY_INSERT, null, $dbfields);

Further testing has revealed this line to be the culprit but I don't see any errors in it... Thoughts?

Have a look at the definition of autoExecute:
bool|MDB2_Error autoExecute( string $table, array $fields_values, [int $mode = MDB2_AUTOQUERY_INSERT], [string $where = false], [array $types = null], [string $result_class = true], [mixed $result_types = MDB2_PREPARE_MANIP])

You have entered "null" for "$where". Try with "false" instead.
 

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
You have entered "null" for "$where". Try with "false" instead.
  1. null is a perfectly valid value for the $where argument. The documentation for autoExecute even uses null.
  2. Note the date of the first post. Don't revive dead threads.
 
Top