#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Location
    wva
    Posts
    82
    Rep Power
    11

    Question I need help setup a SQL DB Table for


    Here what I like to do is on my web site I have a menu that pull from the side. The first word would be Automotive click on it. Thin it will pull out a side menu with Car, Truck, Van click on one of them it will take you to the please you click on.
    How would I set up a dB I have a dB table
    in it have a CategoryID would I setup a addSubCategoryID?

    Here is my table i made

    PHP Code:
    DROP TABLE IF EXISTS product;
    CREATE TABLE product (
      
    ProductID varchar(20)  DEFAULT '' NOT NULL ,
      
    ProductDisabled int(10unsigned   ,
      
    ArtistID varchar(128)  DEFAULT '' NOT NULL ,
      
    CategoryID varchar(32)  DEFAULT '' NOT NULL ,
      
    ManufacturerID varchar(128)    ,
      
    ProductPrice decimal(12,2)  DEFAULT '0.00' NOT NULL ,
      
    RevPtPrice decimal(12,2)  DEFAULT '0.00' NOT NULL ,
      
    tfield decimal(12,2)  DEFAULT '0.00' NOT NULL ,
      
    ProductImageURL varchar(64)    ,
      
    ProductImageThmbURL varchar(64)    ,
      
    ProductOptions varchar(255)  DEFAULT 'noQvalue' NOT NULL ,
      
    ProductWeight decimal(12,2)    ,
      
    ProductShortDescriptionENG varchar(255)    ,
      
    ProductLongDescriptionENG text    ,
      
    ProductShortDescriptionPOR varchar(255)    ,
      
    ProductLongDescriptionPOR text    ,
      
    ProductShortDescriptionSPA varchar(255)    ,
      
    ProductLongDescriptionSPA text    ,
      
    ProductShortDescriptionITA varchar(255)    ,
      
    ProductLongDescriptionITA text    ,
      
    ProductShortDescriptionFRE varchar(255)    ,
      
    ProductLongDescriptionFRE text    ,
      
    ProductShortDescriptionGER varchar(255)    ,
      
    ProductLongDescriptionGER text    
  2. #2
  3. Modding: Oracle MsSQL Firebird
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2001
    Location
    Outside US
    Posts
    8,527
    Rep Power
    539
    You could try something like:

    ProductID|ProductDescription|FatherID|Level

    So to have:

    1|Automotive|1|1
    2|Car|1|2
    3|Truck|1|2
    4|MyOwnCar|2|3

    which can build a flexible hierarchy.

    Hope this helps
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Location
    wva
    Posts
    82
    Rep Power
    11
    How would i code it? I got what you side be think how to code this got me. i'm not good on code thing out.
  6. #4
  7. Modding: Oracle MsSQL Firebird
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2001
    Location
    Outside US
    Posts
    8,527
    Rep Power
    539
    What do you mean by "code"? Write a SQL statement to create it?
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Location
    wva
    Posts
    82
    Rep Power
    11
    How would i do this
    "write a SQL statement to create it"?
  10. #6
  11. Modding: Oracle MsSQL Firebird
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2001
    Location
    Outside US
    Posts
    8,527
    Rep Power
    539
    The following statement, adapted from the one you posted is a sql statement to recreate (drop then create) a table:

    DROP TABLE IF EXISTS product;
    CREATE TABLE product (
    ProductID varchar(20) DEFAULT '' NOT NULL ,
    FatherID varchar(20) DEFAULT '' NOT NULL ,
    Level int(10) unsigned,
    ProductDisabled int(10) unsigned ,
    ArtistID varchar(128) DEFAULT '' NOT NULL ,
    CategoryID varchar(32) DEFAULT '' NOT NULL ,
    ManufacturerID varchar(128) ,
    ProductPrice decimal(12,2) DEFAULT '0.00' NOT NULL ,
    RevPtPrice decimal(12,2) DEFAULT '0.00' NOT NULL ,
    tfield decimal(12,2) DEFAULT '0.00' NOT NULL ,
    ProductImageURL varchar(64) ,
    ProductImageThmbURL varchar(64) ,
    ProductOptions varchar(255) DEFAULT 'noQvalue' NOT NULL ,
    ProductWeight decimal(12,2) ,
    ProductShortDescriptionENG varchar(255) ,
    ProductLongDescriptionENG text ,
    ProductShortDescriptionPOR varchar(255) ,
    ProductLongDescriptionPOR text ,
    ProductShortDescriptionSPA varchar(255) ,
    ProductLongDescriptionSPA text ,
    ProductShortDescriptionITA varchar(255) ,
    ProductLongDescriptionITA text ,
    ProductShortDescriptionFRE varchar(255) ,
    ProductLongDescriptionFRE text ,
    ProductShortDescriptionGER varchar(255) ,
    ProductLongDescriptionGER text ,

IMN logo majestic logo threadwatch logo seochat tools logo