Mysql代码中的错误1064

时间:2014-03-20 04:24:42

标签: php mysql mysql-error-1064

CREATE TABLE IF NOT EXISTS `apayments` (
  `id` int(11) NOT NULL,
  `amount` int(11) NOT NULL,
  `payment_hash` varchar(40) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
  `towho` varchar(128) NOT NULL,
  `money` enum('Pay','Ask') NOT NULL DEFAULT 'Pay',
  `type` enum('email','text') NOT NULL DEFAULT 'email',
       ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

2 个答案:

答案 0 :(得分:1)

删除email附近的逗号

CREATE TABLE IF NOT EXISTS `apayments` (
  `id` int(11) NOT NULL,
  `amount` int(11) NOT NULL,
  `payment_hash` varchar(40) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
  `towho` varchar(128) NOT NULL,
  `money` enum('Pay','Ask') NOT NULL DEFAULT 'Pay',
  `type` enum('email','text') NOT NULL DEFAULT 'email'
                                                    ^^^^^^
       ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

答案 1 :(得分:0)

错误显示,因为有逗号的电子邮件尝试执行此命令

CREATE TABLE IF NOT EXISTS `apayments` (
  `id` int(11) NOT NULL,
  `amount` int(11) NOT NULL,
  `payment_hash` varchar(40) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
  `towho` varchar(128) NOT NULL,
  `money` enum('Pay','Ask') NOT NULL DEFAULT 'Pay',
  `type` enum('email','text') NOT NULL DEFAULT 'email'

  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;