+ Reply to Thread
Results 1 to 3 of 3

Thread: Sql

  1. #1
    niahossain is offline x10Hosting Member niahossain is an unknown quantity at this point
    Join Date
    Oct 2007
    Posts
    16

    Sql

    I went to phpmyadmin, and clicked on the SQL quary link on the upper left corner. in the quary box, i typed in the following to create a table :

    Code:
    Create table Products {
    Product id bigint(20) NOT NULL auto_increment,
    Name varchar(40) NOT NULL default '',
    Shop varchar(100) NOT NULL default '',
    Price varchar(20) NOT NULL default '',
    Category varchar(20) NOT NULL default '',
    PRIMARY KEY (Productid)
    );
    And i got the following error message :

    Code:
     <H1>Error
    Code:
    SQL query: 
    CREATE TABLE Products{Product id bigint( 20 ) NOT NULL AUTO_INCREMENT ,
    Name varchar( 40 ) NOT NULL default '',
    Shop varchar( 100 ) NOT NULL default '',
    Price varchar( 20 ) NOT NULL default '',
    Category varchar( 20 ) NOT NULL default '',
    PRIMARY KEY ( Productid ) 
    
    ) 
    
     
    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 '{
    Product id bigint(20) NOT NULL auto_increment,
    Name varchar(40) NOT NULL def' at line 1
    </H1>
    what should i do ? i am new at this, and i want to create a search option for my database, but i'm not even being able to create a table. Please help !

  2. #2
    rickle42 is offline x10Hosting Member rickle42 is an unknown quantity at this point
    Join Date
    Sep 2007
    Posts
    59

    Re: Sql

    Just on a quick look I noticed the problem i think....
    You start with { and end with ). needs to be either () or {}.
    Edit:
    Also Productid has a space when it is declared then no space when calling it a primary id. I dont know if its ok to have a space in mysql field names.
    Product id ----- Looks funny to me. You could do Product_id or Productid.
    Last edited by rickle42; 10-17-2007 at 07:13 PM. Reason: Automerged Doublepost

  3. #3
    jsobeck is offline x10 Sophmore jsobeck is an unknown quantity at this point
    Join Date
    Jun 2006
    Location
    Detroit, Michigan
    Posts
    240

    Re: Sql

    I would suggest using phpmyadmin's form for creating a new table, I would think it should simplify things.

+ Reply to Thread

Similar Threads

  1. Anyone know sql?
    By zero5854 in forum Free Hosting
    Replies: 4
    Last Post: 08-15-2007, 10:29 AM
  2. i last my sql data
    By sahil3x1 in forum Free Hosting
    Replies: 2
    Last Post: 08-28-2006, 06:31 AM
  3. sql backup/restore
    By darkjetx in forum Free Hosting
    Replies: 6
    Last Post: 11-12-2005, 06:50 AM
  4. SQL Help
    By Shadow in forum Free Hosting
    Replies: 11
    Last Post: 04-04-2005, 01:15 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers