Jump to content
php.lv forumi

SQL syntaxes kļūda..


lostz

Recommended Posts

sāku mocīt sql'u, un sākot darbu ar lietotājiem, kaut kas sāka neiet, un kļūdu sintaksē nesaskatu, varbūt jau acis kubā varbūt vienkārši nezinu..

vai var kāds palīdzēt?

 

Kods:

CREATE TABLE `lietotajs` (
 `id` int(11) NOT NULL auto_increment,
 `login` varchar(255) NOT NULL default '',
 `dzi` enum('male','female') NOT NULL default 'male',
 `valuta` int(11) NOT NULL default '0',
 `mid` tinyint(3) unsigned NOT NULL default '1',
 `x` smallint(6) NOT NULL default '0',
 `y` smallint(6) NOT NULL default '0',
 `status` enum('online','inmove','....','wait','inaction') NOT NULL default 'online',
 `lastupdate` timestamp(14) NOT NULL,
 `jbid` smallint(5) unsigned NOT NULL default '0',
 `jtime` int(11) NOT NULL default '0',
 `a_hour` tinyint(3) unsigned NOT NULL default '0',
 `maksa` smallint(5) unsigned NOT NULL default '0',
 `dzt` smallint(5) unsigned NOT NULL default '40',
 `dzm` smallint(5) unsigned NOT NULL default '40',
 `dzu` timestamp(14) NOT NULL default '00000000000000',
 `pwr` smallint(6) NOT NULL default '10',
 `drg` smallint(6) NOT NULL default '30',
 `stpm` timestamp(14) NOT NULL default '00000000000000',
 `refer` int(11) NOT NULL default '0',
 `pers_info` varchar(255) NOT NULL default '',
 `seccode` smallint(6) NOT NULL default '0',
 `quest_col` smallint(5) unsigned NOT NULL default '0',
 `quest_gen` int(11) NOT NULL default '0',
 `quest_war_gen` int(11) NOT NULL default '0',
 `quest_war_col` smallint(5) unsigned NOT NULL default '0',
 `corpid` smallint(6) NOT NULL default '0',
 `plen_id` int(11) NOT NULL default '0',
 `plen_h` smallint(6) NOT NULL default '0',
 `plen_ti` int(11) NOT NULL default '0',
 `ref_col` smallint(5) unsigned NOT NULL default '0',
 PRIMARY KEY  (`id`),
 UNIQUE KEY `login_2` (`login`),
 KEY `login` (`login`),
 KEY `status` (`status`),
 KEY `x` (`x`),
 KEY `y` (`y`),
 KEY `job` (`jbid`,`jtime`)
) ENGINE=MyISAM PACK_KEYS=0

Kļūda:

#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, `jbid` smallint(5) unsigned NOT NULL default '0', `jtime` i' at line 10

Link to comment
Share on other sites

Tagad ies ;)

 

--
-- MySQL 5.1.54
-- Sat, 23 Jul 2011 09:02:33 +0000
--

CREATE TABLE `lietotajs` (
  `id` int(11) not null auto_increment,
  `login` varchar(255) not null,
  `dzi` enum('male','female') not null default 'male',
  `valuta` int(11) not null default '0',
  `mid` tinyint(3) unsigned not null default '1',
  `x` smallint(6) not null default '0',
  `y` smallint(6) not null default '0',
  `status` enum('online','inmove','....','wait','inaction') not null default 'online',
  `lastupdate` timestamp not null default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
  `jbid` smallint(5) unsigned not null default '0',
  `jtime` int(11) not null default '0',
  `a_hour` tinyint(3) unsigned not null default '0',
  `maksa` smallint(5) unsigned not null default '0',
  `dzt` smallint(5) unsigned not null default '40',
  `dzm` smallint(5) unsigned not null default '40',
  `dzu` timestamp not null default '0000-00-00 00:00:00',
  `pwr` smallint(6) not null default '10',
  `drg` smallint(6) not null default '30',
  `stpm` timestamp not null default '0000-00-00 00:00:00',
  `refer` int(11) not null default '0',
  `pers_info` varchar(255) not null,
  `seccode` smallint(6) not null default '0',
  `quest_col` smallint(5) unsigned not null default '0',
  `quest_gen` int(11) not null default '0',
  `quest_war_gen` int(11) not null default '0',
  `quest_war_col` smallint(5) unsigned not null default '0',
  `corpid` smallint(6) not null default '0',
  `plen_id` int(11) not null default '0',
  `plen_h` smallint(6) not null default '0',
  `plen_ti` int(11) not null default '0',
  `ref_col` smallint(5) unsigned not null default '0',
  PRIMARY KEY (`id`),
  UNIQUE KEY (`login`),
  KEY `login` (`login`),
  KEY `status` (`status`),
  KEY `x` (`x`),
  KEY `y` (`y`),
  KEY `job` (`jbid`,`jtime`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;

-- [Table `lietotajs` is empty]

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...