WEB Simple SQL Error... any help please.

Discussion in 'OT Technology' started by Ricky, Apr 14, 2008.

  1. Ricky

    Ricky █▄ █▄█ █▄ ▀█▄

    Joined:
    Jun 17, 2005
    Messages:
    38,767
    Likes Received:
    6
    I was told to input this into my table with phpmyadmin

    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 im getting this error message

    [​IMG]

    Thanks :)... i suck at teh sql
     
  2. Vailripper

    Vailripper Daywalkers have feelings too.

    Joined:
    Jan 25, 2006
    Messages:
    6,170
    Likes Received:
    0
    Location:
    Bellingham, WA
    `imgId` varchar(100) NOT NULL default ‘’,

    If you want the default to be blank, you can just drop that part off:
    `imgId` varchar(100) NOT NULL,

    Also, in less you're getting imgID from some other source, you probably will want to make that an identity field, as it is your primary key.

    EDIT: that doesn't fix it :(
     
  3. thomor25

    thomor25 I make money online....

    Joined:
    Jun 11, 2000
    Messages:
    11,101
    Likes Received:
    0
    Location:
    Denver Colorado
    i think you are using the wrong ticks
     
  4. Ricky

    Ricky █▄ █▄█ █▄ ▀█▄

    Joined:
    Jun 17, 2005
    Messages:
    38,767
    Likes Received:
    6
    i think you're right.

    i tried this
    Code:
    CREATE TABLE `vote` (
      `voteNr ` varchar(11) NOT NULL default 0,
      `voteValue ` int(8) NOT NULL default 0,
      `imgId ` varchar(100) NOT NULL default,
    UNIQUE KEY `imgId` (`imgId`) 
    ) TYPE=MyISAM;
    and i'm getting this now


    MySQL said:

    im sure it's a user error :o
     
  5. Vailripper

    Vailripper Daywalkers have feelings too.

    Joined:
    Jan 25, 2006
    Messages:
    6,170
    Likes Received:
    0
    Location:
    Bellingham, WA
    CREATE TABLE `vote` (
    `voteNr` varchar(11) NOT NULL default 0,
    `voteValue` int(8) NOT NULL default 0,
    `imgId` varchar(100) NOT NULL PRIMARY KEY
    ) TYPE=MyISAM

    That one works...I'm not sure what you're trying to with unique key, but I think primary key is what you want to use.

    The spaces after the column names were throwing an error.
     
  6. Ricky

    Ricky █▄ █▄█ █▄ ▀█▄

    Joined:
    Jun 17, 2005
    Messages:
    38,767
    Likes Received:
    6
    ahh okay. yeah it looks like it works.

    thank you very much :)
     

Share This Page