Home » Database » MDB2 » Bug #7687
Syntax error. In autoexecute
Details
| Request #7687 | Syntax error. In autoexecute |
|---|---|
| Submitted | 2006-05-21 23:54 UTC |
| From | rabzelj dot janez at gmail dot com |
| Status | Duplicate |
| Package | MDB2 |
| PHP Version | 5.1.2 |
| OS | Debian Unstable GNU/Linux |
| Roadmaps | (Not assigned) |
Comments
[2006-05-21 23:54 UTC] rabzelj dot janez at gmail dot com
Description:
------------
The package only say "Syntax error" but the syntax is correct, check it. I have tested the code and i have checked the code a lot and, i think this is a bug.
Test script:
---------------
http://phpfi.com/119122
(SQL Table for the script)
CREATE TABLE `phones` (
`id` INT NULL AUTO_INCREMENT PRIMARY KEY ,
`name` TEXT NULL ,
`lastname` TEXT NULL ,
`phone` TEXT NULL ,
`cellphone` TEXT NULL ,
`country` TEXT NULL ,
`city` TEXT NULL ,
`email` TEXT NULL ,
`group` TEXT NULL ,
`time` DATE NULL
) TYPE = MYISAM
Expected result:
----------------
The fields value in the table
Actual result:
--------------
Nothing, only say "Error syntax"
[2006-05-22 00:08 UTC] rabzelj dot janez at gmail dot com
The code!!
<?php
require 'MDB2.php';
$dsn = 'mysql://root:huhuhulocalhost/phonebook';
$table = 'phones';
$data = array(
'name'=>$name,
'lastname'=>$lastname,
'phone'=>$phone,
'cellphone'=>$cellphone,
'country'=>$country,
'city'=>$city,
'email'=>$email,
'group'=>$group,
'time'=>$time
);
$types = array('integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'date');
$options = array(
'debug' => 2,
'portability' => MDB2_PORTABILITY_ALL
);
$mdb2 =& MDB2::connect($dsn, $options);
$mdb2->loadModule('Extended');
$res = $mdb2->extended->autoExecute($table, $data,
MDB2_AUTOQUERY_INSERT, null, $types);
if (PEAR::isError($res)) {
function dump($mdb2)
{
echo '<pre>' . print_r($var) . '</pre>';
}
dump($mdb2);
die($res->getMessage());
}
$mdb2->disconnect();
?>