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
https://forums.phpfreaks.com/topic/196341-syntx-error/
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
https://forums.phpfreaks.com/topic/196341-syntx-error/#findComment-1030969
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
https://forums.phpfreaks.com/topic/196341-syntx-error/#findComment-1030975
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.