I get the following Mysql error message, when I run it in the Phpmyadmin SQL command.
"Error in query (1064): Syntax error near 'IF NOT EXISTS TABLE 'o2o_category'( 'id' int(11) NOT NULL AUTO_INCREMENT, ' at line 2 "
The sql is below:
CREATE IF NOT EXISTS TABLE 'o2o_category'(
'id' int(11) NOT NULL AUTO_INCREMENT,
'name' VARCHAR(50) NOT NULL DEFAULT '',
'parent_id' int(10) NOT NULL DEFAULT 0,
'listorder' int(8) NOT NULL DEFAULT 0,
'status' tinyint(1) NOT NULL DEFAULT 0,
'create_time' int(11) NOT NULL DEFAULT 0,
'update_time' int(11) NOT NULL DEFAULT 0,
PRIMARY KEY ('id'),
KEY parent_id('parent_id')
)ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
Can u give me some clues about what wrong is?
Thanks
It should be CREATE TABLE IF NOT EXISTS
and not CREATE IF NOT EXISTS TABLE
CREATE TABLE IF NOT EXISTS `o2o_category`(
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` VARCHAR(50) NOT NULL DEFAULT '',
`parent_id` int(10) NOT NULL DEFAULT 0,
`listorder` int(8) NOT NULL DEFAULT 0,
`status` tinyint(1) NOT NULL DEFAULT 0,
`create_time` int(11) NOT NULL DEFAULT 0,
`update_time` int(11) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`),
KEY parent_id(`parent_id`))ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.