Jump to content

[SOLVED] You have an error in your SQL syntax; CREATE TABLE error...


d22552000

Recommended Posts

For the life of me I can't figure out what's wrong with this code...

 

CREATE TABLE `cronlog` (
  `cronlogid` int(10) unsigned NOT NULL auto_increment,
  `varname` varchar(100) NOT NULL default '',
  `dateline` int(10) unsigned NOT NULL default '0',
  `description` mediumtext,
  `type` smallint(5) unsigned NOT NULL default '0',
  PRIMARY KEY  (`cronlogid`),
  KEY `varname` (`varname`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;

CREATE TABLE `customavatar` (
  `userid` int(10) unsigned NOT NULL default '0',
  `filedata` mediumblob,
  `dateline` int(10) unsigned NOT NULL default '0',
  `filename` varchar(100) NOT NULL default '',
  `visible` smallint(6) NOT NULL default '1',
  `filesize` int(10) unsigned NOT NULL default '0',
  `width` smallint(5) unsigned NOT NULL default '0',
  `height` smallint(5) unsigned NOT NULL default '0',
  PRIMARY KEY  (`userid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

 

I get:

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 '; CREATE TABLE `customavatar` ( `userid` int(10) unsigned NOT NULL default' at line 9

 

Line 9 is:

) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;

 

What's wrong?

Link to comment
Share on other sites

well this is a phpmyadmin dump... it worked before..

 

but for some reason it came with:

 

SET_SQL_MODE= NO_NULL_ON_ZERO

 

or something close to that, but I deleted it by accident.

 

If you know the syntax for that, i could add it back in.

Link to comment
Share on other sites

It's not the "NOT NULL" clause... I removed those and got:

 

#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 ''customavatar' (
  'userid' int(10) unsigned default '0',
  'filedata' mediumb' at line 1 

 

CREATE TABLE 'customavatar'(

'userid'int( 10 ) unsigned default '0',
'filedata'mediumblob,
'dateline'int( 10 ) unsigned default '0',
'filename'varchar( 100 ) default '',
'visible'smallint( 6 ) default '1',
'filesize'int( 10 ) unsigned default '0',
'width'smallint( 5 ) unsigned default '0',
'height'smallint( 5 ) unsigned default '0',
PRIMARY KEY ( 'userid' ) 
) 

Link to comment
Share on other sites

CREATE TABLE `cronlog` (
  `cronlogid` int(10) unsigned NOT NULL auto_increment,
  `varname` varchar(100) NOT NULL default '',
  `dateline` int(10) unsigned NOT NULL default '0',
  `description` mediumtext,
  `type` smallint(5) unsigned NOT NULL default '0',
  PRIMARY KEY  (`cronlogid`),
  KEY `varname` (`varname`)
) TYPE=InnoDB AUTO_INCREMENT=1;

CREATE TABLE `customavatar` (
  `userid` int(10) unsigned NOT NULL default '0',
  `filedata` mediumblob,
  `dateline` int(10) unsigned NOT NULL default '0',
  `filename` varchar(100) NOT NULL default '',
  `visible` smallint(6) NOT NULL default '1',
  `filesize` int(10) unsigned NOT NULL default '0',
  `width` smallint(5) unsigned NOT NULL default '0',
  `height` smallint(5) unsigned NOT NULL default '0',
  PRIMARY KEY  (`userid`)
) TYPE=InnoDB; 

 

That works perfectly for me.  It's only a minor variant of yours.  Give it a try (delete either table if it already exists)

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.