Jump to content

mysql database issue help...........


Recommended Posts

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 ,

Link to comment
Share on other sites

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 ...

+- catid

Now you categories table will look like this:
Cateories
|
+- cid
+- name
+- description

Now 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=1

Then the sql will be ran and will get all the products with the catid of 1.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.