Jump to content

[SOLVED] Showing data from 2 joine tables


alex_funky_dj

Recommended Posts

Hello,

 

I've 2 tables with the following structure :

 

Table 1 name : categories

Fields : id, code, name.

 

Table 2 name : Products

Fields : id, category_id, code, name

 

and here's MySQL query :

$query="SELECT *
FROM products
INNER JOIN categories
ON products.categpry_id = categories.id";

$result = mysql_query($query);

$row = mysql_fetch_array($result);

Now, I've the problem with "echo ()" !!

when I make :

 echo $row[name]; 

it shows the name of product, how can I show the category name ??

I tried

 echo $row[categories.name]; 

but I'm having errors !!

 

so how can I handle this ??

 

THANK YOU FOR YOUR TIME !

 

Link to comment
https://forums.phpfreaks.com/topic/69451-solved-showing-data-from-2-joine-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.