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