Re: Fields from different tables
| From: | heilo | Date: | Sun, 11 May 2003 17:03:44 +0000 |
| Subject: | Re: Fields from different tables | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-27649@lists.php.net to get a copy of this message | ||
hi!
you can do it this way:
SELECT
product.id,
product.name,
category.name AS cat_name
FROM
product,
category
WHERE
category.id=product.id_category
hope this works?
.ma
Dani Matielo <dmatielo@uol.com.br> wrote@11.05.2003 18:59 Uhr:
> Ok, this problem is a little more complicate: I have 2 diferente tables, say
> product and category. In product I have fields
>
> id
> name
> id_category
>
> and in category I have fields
> id
> name
>
> Well, obviously, the field 'id_category' in product refers to the field
> 'id'
> in the table category. Very well. Now I am making an array with my products
> but instead of the field 'id_category' I would like the name of the category
> to appear in the array...
>
> How do I do that? :(
>
> Dani
> Who's still in PHP basics...
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.476 / Virus Database: 273 - Release Date: 24/4/2003
>
>