d22552000 Posted August 16, 2007 Share Posted August 16, 2007 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? Quote Link to comment https://forums.phpfreaks.com/topic/65203-solved-you-have-an-error-in-your-sql-syntax-create-table-error/ Share on other sites More sharing options...
thedarkwinter Posted August 16, 2007 Share Posted August 16, 2007 whats the autoincrement doing there? (maybe you can do it, but i dont think so??) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1; Quote Link to comment https://forums.phpfreaks.com/topic/65203-solved-you-have-an-error-in-your-sql-syntax-create-table-error/#findComment-325592 Share on other sites More sharing options...
Illusion Posted August 16, 2007 Share Posted August 16, 2007 NOT NULL constraint and default clause '0' contraducting each other. Quote Link to comment https://forums.phpfreaks.com/topic/65203-solved-you-have-an-error-in-your-sql-syntax-create-table-error/#findComment-325593 Share on other sites More sharing options...
d22552000 Posted August 16, 2007 Author Share Posted August 16, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/65203-solved-you-have-an-error-in-your-sql-syntax-create-table-error/#findComment-325954 Share on other sites More sharing options...
d22552000 Posted August 16, 2007 Author Share Posted August 16, 2007 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' ) ) Quote Link to comment https://forums.phpfreaks.com/topic/65203-solved-you-have-an-error-in-your-sql-syntax-create-table-error/#findComment-326000 Share on other sites More sharing options...
d22552000 Posted August 16, 2007 Author Share Posted August 16, 2007 any help would be apreciated. Quote Link to comment https://forums.phpfreaks.com/topic/65203-solved-you-have-an-error-in-your-sql-syntax-create-table-error/#findComment-326104 Share on other sites More sharing options...
AndyB Posted August 16, 2007 Share Posted August 16, 2007 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) Quote Link to comment https://forums.phpfreaks.com/topic/65203-solved-you-have-an-error-in-your-sql-syntax-create-table-error/#findComment-326133 Share on other sites More sharing options...
d22552000 Posted August 16, 2007 Author Share Posted August 16, 2007 thanks! Quote Link to comment https://forums.phpfreaks.com/topic/65203-solved-you-have-an-error-in-your-sql-syntax-create-table-error/#findComment-326197 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.