Web Hosting Talk







View Full Version : MYSQL Error


mystycs
02-05-2010, 04:33 AM
I am trying to create this table with this code

CREATE TABLE `vote` (
`voteNr` int(8) NOT NULL default ‘0’,
`voteValue` int(8) NOT NULL default ‘0’,
`imgId` varchar(100) NOT NULL default ‘’,
UNIQUE KEY `imgId` (`imgId`)
) TYPE=MyISAM;


But i am getting an error

SQL query:

CREATE TABLE `vote` (

`voteNr` INT( 8 ) NOT NULL DEFAULT‘0’,
`voteValue` INT( 8 ) NOT NULL DEFAULT‘0’,
`imgId` VARCHAR( 100 ) NOT NULL DEFAULT‘’,
UNIQUE KEY `imgId` ( `imgId` )
) TYPE = MYISAM
MySQL said:

#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 '‘0’,
`voteValue` int(8) NOT NULL default ‘0’,
`imgId` ' at line 2



How can i fix this issue? Is there something wrong in the mysql code?

Neseema M M
02-05-2010, 04:46 AM
The mysql code you used is correct. But I think it is the problem of quote you used there.
Try to rewrite it using single quote.


CREATE TABLE `vote` (
`voteNr` int(8) NOT NULL default '0',
`voteValue` int(8) NOT NULL default '0',
`imgId` varchar(100) NOT NULL default '',
UNIQUE KEY `imgId` (`imgId`) ) TYPE=MyISAM;



Hope it jelps.:)

mystycs
02-05-2010, 04:50 AM
Yea i caught the error, there was ‘’ symbols instead of '' symbols, thanks though :)