Jump to content

Linking my tables....


romio

Recommended Posts

well am a bit confused, my database should include many categories and each category could have one or more product, i have designed both of my tables, but how will i proceed now, how do i join them....

[code]

CREATE TABLE categories
(
              
                 categoryID int(11) NOT NULL auto_increment RIMARY KEY,  
                 name varchar(255) default NULL,              
                 parent int(11) default NULL,                
                 products_count int(11) default NULL,        
                 description text,                            
                 picture varchar(30) default NULL,            
                 products_count_admin int(11) default NULL
);
[/code]
[code]
CREATE TABLE products
(                      
               productID int(11) NOT NULL auto_increment PRIMARY KEY,    
               categoryID int(11) default NULL,              
               name varchar(255) default NULL,              
               description text,                            
               customers_rating float NOT NULL default '0',  
               Price float default NULL,                    
               picture varchar(30) default NULL,            
               in_stock int(11) default NULL,                
               thumbnail varchar(30) default NULL,
               items_sold int(11) NOT NULL default '0',      
               big_picture varchar(30) default NULL,        
               enabled int(11) NOT NULL default '0',        
               brief_description text,                      
               list_price float default NULL,                
               product_code varchar(25) default NULL                    
);
[/code]
Link to comment
https://forums.phpfreaks.com/topic/4002-linking-my-tables/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.