the apprentice webmaster Posted April 4, 2006 Share Posted April 4, 2006 hi to all you guys , i got a question for you guys , i am having a problem with that , i wanna create some categories table n also some product table , but i don't really know how to go about it , for example i got : x-box , ps2 , psp, gamecube , pikachu toys , suppercar , drill set , ashley posters and i have : toys , games ,poster , hardware , etc so guys my question is between them , which one can be place into the product table , and which one can be placed into the category table , i don't know if i explain it well n precise , any input , any help will be appreciated , thx in advance , i 'll be online for another hours , Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted April 4, 2006 Share Posted April 4, 2006 You'll want to create two tables called products and cateogries. In the products table you store all your products that you have when you create your table make sure you create an extra row cam call that catid as this will be used for getting the correct products for each category. SO you products table will loook like this:Products|+- pid+- name+-description+- price... more rows here ...+- catidNow you categories table will look like this:Cateories|+- cid+- name+- descriptionNow when you do your MySQL Query you'll want to do it like so:SELECT * FROM products WHERE catid = $_GET['cid']$_GET['cid'] is passed over the url like so: products.php?cid=1Then the sql will be ran and will get all the products with the catid of 1. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.