有人可以帮我查一下这段代码

时间:2013-03-07 19:34:08

标签: php mysql

我收到此错误,我不知道问题出在哪里:

Error

SQL query:

CREATE TABLE `dp_confirms` ( 
`id` int(11) NOT NULL auto_increment, 
`newuser` varchar(32) NOT NULL default '', 
`newpass` varchar(32) NOT NULL default '', 
`newquestion` varchar(255) NOT NULL default '', 
`newanswer` varchar(255) NOT NULL default '', 
`newmail` varchar(255) NOT NULL default '', 
`newfname` varchar(32) NOT NULL default '', 
`newlname` varchar(32) NOT NULL default '', 
`newcompany` varchar(128) NOT NULL default '', 
`newregnum` varchar(32) NOT NULL default '', 
`newdrvnum` varchar(32) NOT NULL default '', 
`newaddress` varchar(128) NOT NULL default '', 
`newcity` varchar(64) NOT NULL default '', 
`newcountry` char(2) NOT NULL default '', 
`newstate` varchar(32) NOT NULL default '', 
`newzip` varchar(32) NOT NULL default '', 
`newphone` varchar(64) NOT NULL default '', 
`newfax` varchar(64) NOT NULL default '', 
`sponsor` int(11) NOT NULL default '0', 
`confirm` varchar(255) NOT NULL default '', 
`cdate` timestamp(14) NOT NULL,[...])

MySQL said: Documentation
#1064 - 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 '(14) NOT NULL,
  PRIMARY KEY  (`id`),
  UNIQUE KEY `newuser` (`newuser`),
  K' at line 22 

这是主要代码。

-- 
    -- Table structure for table `dp_cards`
    -- 

    DROP TABLE IF EXISTS `dp_cards`;
    CREATE TABLE `dp_cards` (
      `id` int(11) NOT NULL auto_increment,
      `owner` int(11) NOT NULL default '0',
      `ctype` varchar(8) NOT NULL default '',
      `cname` varchar(64) NOT NULL default '',
      `cnumber` varchar(32) NOT NULL default '',
      `ccvv` varchar(16) NOT NULL default '',
      `cmonth` tinyint(2) NOT NULL default '0',
      `cyear` smallint(6) NOT NULL default '0',
      `status` tinyint(1) NOT NULL default '0',
      `default` tinyint(1) NOT NULL default '0',
      PRIMARY KEY  (`id`)
    ) ENGINE=MyISAM AUTO_INCREMENT=1 ;

    -- --------------------------------------------------------

    -- 
    -- Table structure for table `dp_confirms`
    -- 

    DROP TABLE IF EXISTS `dp_confirms`;
    CREATE TABLE `dp_confirms` (
      `id` int(11) NOT NULL auto_increment,
      `newuser` varchar(32) NOT NULL default '',
      `newpass` varchar(32) NOT NULL default '',
      `newquestion` varchar(255) NOT NULL default '',
      `newanswer` varchar(255) NOT NULL default '',
      `newmail` varchar(255) NOT NULL default '',
      `newfname` varchar(32) NOT NULL default '',
      `newlname` varchar(32) NOT NULL default '',
      `newcompany` varchar(128) NOT NULL default '',
      `newregnum` varchar(32) NOT NULL default '',
      `newdrvnum` varchar(32) NOT NULL default '',
      `newaddress` varchar(128) NOT NULL default '',
      `newcity` varchar(64) NOT NULL default '',
      `newcountry` char(2) NOT NULL default '',
      `newstate` varchar(32) NOT NULL default '',
      `newzip` varchar(32) NOT NULL default '',
      `newphone` varchar(64) NOT NULL default '',
      `newfax` varchar(64) NOT NULL default '',
      `sponsor` int(11) NOT NULL default '0',
      `confirm` varchar(255) NOT NULL default '',
      `cdate` timestamp(14) NOT NULL,
      PRIMARY KEY  (`id`),
      UNIQUE KEY `newuser` (`newuser`),
      KEY `newmail` (`newmail`)
    ) ENGINE=MyISAM AUTO_INCREMENT=1 ;

1 个答案:

答案 0 :(得分:6)

我相信TIMESTAMP字段不会占用大小。删除(14)