SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Enthusiast Adam Black's Avatar
    Join Date
    Oct 2000
    Location
    Nova Scotia, Canada
    Posts
    99
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    is there anything wrong wiht this?

    is there anything wrong with this?


    CREATE TABLE user(ID INT NOT NULL AUTO_INCREMENT,memID VARCHAR(100) NOT NULL ,email VARCHAR(100) NOT NULL ,password CHAR(16) NOT NULL ,fedname VARCHAR(100) NOT NULL ,rulername VARCHAR(100) NOT NULL ,age VARCHAR(100) NOT NULL ,country VARCHAR(100) NOT NULL , PRIMARY KEY (ID), UNIQUE (memID))
    whenever i put that in it says:
    You have an error in your SQL syntax near 'user(ID INT NOT NULL AUTO_INCREMENT,memID VARCHAR(100) NOT NULL ,email VARCHAR' at line 1.
    Last edited by Adam Black; Sep 22, 2001 at 07:43.

  2. #2
    SitePoint Wizard johnn's Avatar
    Join Date
    Mar 2001
    Location
    Southern California, USA
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I guess ID is a primary key, so you don't need "NOT NULL"

  3. #3
    SitePoint Enthusiast Adam Black's Avatar
    Join Date
    Oct 2000
    Location
    Nova Scotia, Canada
    Posts
    99
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    naw it still dosn't work it says:
    MySQL said: You have an error in your SQL syntax near 'user(ID INT AUTO_INCREMENT,memID VARCHAR(100) NOT NULL ,email VARCHAR(100) NOT N' at line 1.

  4. #4
    SitePoint Wizard johnn's Avatar
    Join Date
    Mar 2001
    Location
    Southern California, USA
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try
    ID INT NOT NULL AUTO_INCREMENT PRIMARY KEY,

    and remove primary key line at the bottom.

  5. #5
    SitePoint Enthusiast Adam Black's Avatar
    Join Date
    Oct 2000
    Location
    Nova Scotia, Canada
    Posts
    99
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    nvm i got it to work. i had already tried it i named the table different and it worked

  6. #6
    SitePoint Zealot
    Join Date
    Jun 2000
    Location
    Yeppoon, Australia
    Posts
    186
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The problem was the table name; user - this seems to be a reserved table name to MySQL. It uses it to store MySQL user information - grants, etc. in the MySQL database.

    If you still want to call the table user, reference the database you're putting it into. So if your database is called jokes you would do this:

    CREATE TABLE jokes.user(ID ....);
    Knowledge is knowing that a tomatoe is a fruit; wisdom is not putting it in a fruit salad.

  7. #7
    Making a better wheel silver trophy DR_LaRRY_PEpPeR's Avatar
    Join Date
    Jul 2001
    Location
    Missouri
    Posts
    3,428
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by johnn
    I guess ID is a primary key, so you don't need "NOT NULL"
    just to clarify - the PRIMARY KEY has to be NOT NULL.
    - Matt ** Ignore old signature for now... **
    Dr.BB - Highly optimized to be 2-3x faster than the "Big 3."
    "Do not enclose numeric values in quotes -- that is very non-standard and will only work on MySQL." - MattR


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •