Jump to content

combining multiple tables into one


mendoz

Recommended Posts

Hey freaks.

So here it goes.
I have a site with 5 categories(pcs,laptops...).
Normally I would create 5 tables for each category and then use:
"[color=green]SELECT * from '$table' WHERE id='$id'[/color]" or something like that.

So now I want to use a single table. How I get the correct line of the correct category.
For example: Get line number three from all the lines where type=laptop.

This can't be to hard for you guys,
I hope you're up for the "challange"...  :o
Link to comment
Share on other sites

I only have 1 table containing different product categories:

| product id | category |
------------------------
|      1      |  laptops  |
|      2      |  cooling  |
|      3      |    pc's  |
|      4      |  laptops  |
|      5      |    pc's  |
------------------------

I want to get all the laptops and sort them like this: 1,2...
So I could use them with loops and stuff.

Any idea?
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.