วีธีแก้ไข error check the manual that corresponds to your MySQL server version for the right syntax to use near 'defaul

SQL Knowledge ทั้ง sql มาตรฐาน หลักการออกแบบฐานข้อมูล ความสัมพันธ์ของ ตาราง Mysql , PGSQL, Oracle, MSSQL

Moderators: mindphp, ผู้ดูแลกระดาน

User avatar
thatsawan
PHP VIP Members
PHP VIP Members
Posts: 27193
Joined: 31/03/2014 10:02 am
Contact:

วีธีแก้ไข error check the manual that corresponds to your MySQL server version for the right syntax to use near 'defaul

Post by thatsawan »

SQL ERROR [ mysqli ]

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'default int(11) UNSIGNED NULL, PRIMARY KEY (id) ) CHARACTER SET `utf8` COLLAT' at line 12 [1064]

SQL

CREATE TABLE phpbb_user_upload ( id int(11) UNSIGNED NOT NULL auto_increment, firstname varchar(150) NULL, lastname varchar(150) NULL, pass_id varchar(150) NULL, user_active int(11) UNSIGNED NULL, user_lastvisit int(11) UNSIGNED DEFAULT '0' NOT NULL, user_register_time int(11) UNSIGNED DEFAULT '0' NOT NULL, user_id int(11) UNSIGNED NULL, attach_id int(11) UNSIGNED NULL, columns int(11) UNSIGNED NULL, default int(11) UNSIGNED NULL, PRIMARY KEY (id) ) CHARACTER SET `utf8` COLLATE `utf8_bin`;

BACKTRACE

Code: Select all

$this->table_prefix . 'user_upload' => array(
                    'COLUMNS' => array(
                        'id' => array('UINT:11', null, 'auto_increment'),
                        'firstname' => array('VCHAR:150', null, ''),
                        'lastname' => array('VCHAR:150', null, ''),
                        'pass_id' => array('VCHAR:150', null, ''),
                        'user_active' => array('UINT:11', null, ''),
                        'user_lastvisit' => array('TIMESTAMP', 0),
                        'user_register_time' => array('TIMESTAMP', 0),
                        'user_id' => array('UINT:11', null, ''),
                        'attach_id' => array('UINT:11', null, ''),
                        'columns' => array('UINT:11', null, ''),
                        'default' => array('UINT:11', null, ''),
                    ),
                    'PRIMARY_KEY' => 'id',
//                    'KEYS' => array(
//                        'id' => array('UNIQUE', 'id'),
//                    ),
                ), 
ปัญหาเกิดจากชื่อฟิลด์ default ไม่สามารถใช้ได้เพราะเป็นชื่อที่สงวนไว้ เราจะต้องเปลี่ยนชื่อฟิลด์เพื่อแก้ไขปัญหา
  • Similar Topics
    Replies
    Views
    Last post

Return to “SQL Knowledge”

Who is online

Users browsing this forum: No registered users and 3 guests