Jump to content

Syntx error


LOUDMOUTH

Recommended Posts

I am trying to query this and am getting a syntax error, am I doing this completely wrong? haha

 

query

-- Table structure for table `adds`
CREATE TABLE IF NOT EXISTS `adds` (
  `id` int(10) NOT NULL auto_increment=1,
  `fid` int(15) default NULL,
  `added` int(15) defaultNULL,
  PRIMARY KEY  (`id`),
  KEY `fid` (`fid`)
) TYPE=MyISAM  AUTO_INCREMENT=2058469 ;
-- Dumping data for table `adds`
-- Table structure for table `admin`
--

CREATE TABLE IF NOT EXISTS `admin` (
  `id` int(10) NOT NULL auto_increment,
  `admin` varchar(10) NOT NULL,
  `password` varchar(20) NOT NULL,
  PRIMARY KEY  (`id`)
) TYPE=MyISAM  AUTO_INCREMENT=2 ;

--
-- Dumping data for table `admin`
--

INSERT INTO `admin` (`id`, `username`, `password`) VALUES
(1, 'username', 'password');

 

 

 

error i am getting

Error

SQL query:

-- Table structure for table `adds`
CREATE TABLE IF NOT EXISTS `adds` (
`id` int( 10 ) NOT NULL AUTO_INCREMENT =1,
`fid` int( 15 ) default NULL ,
`added` int( 15 ) defaultNULL,
PRIMARY KEY ( `id` ) ,
KEY `fid` ( `fid` )
) TYPE = MYISAM AUTO_INCREMENT =2058469;

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 '=1,
  `fid` int(15) default NULL,
  `added` int(15) defaultNULL,
  PRIMARY KE' at line 2 

 

 

Link to comment
Share on other sites

Uh... how about reading the error message?

 

#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 '=1,

  `fid` int(15) default NULL,

  `added` int(15) defaultNULL,

  PRIMARY KE' at line 2

 

Does this look correct to you?

  `added` int(15) defaultNULL,

Link to comment
Share on other sites

LOUDMOUTH,

 

I took out the =1 from your autoincrement parmater, and added the missing space, ran the altered code throught phpMyAdmin's SQL parser and got a valid table defined.

 

 

 

CREATE TABLE IF NOT EXISTS `adds` (`id` int( 10 ) NOT NULL AUTO_INCREMENT,`fid` int( 15 ) default NULL ,`added` int( 15 ) default NULL,PRIMARY KEY ( `id` ) ,KEY `fid` ( `fid` )) TYPE = MYISAM AUTO_INCREMENT =2058469

 

 

 

Scot L. Diddle, Richmond VA

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.