Jump to content

Grab data from 2 tables.


sean04

Recommended Posts

Hey guys, so I have 2 tables...

 

user_detail

ID      Email                                          Country

1      [email protected]        1

 

country

ID    Country

1    Canada

2    States

 

How can I write a query so when I call a variable to get my country it gets "Canada" instead of "1"

 

Thanks!

Link to comment
https://forums.phpfreaks.com/topic/197649-grab-data-from-2-tables/
Share on other sites

Thanks for the reply!

 

I get this error: Resource id #10

 

I want to call the results from another page... Like a profile page of that user.

 

$loggedUserCountry = mysql_query("SELECT u.User_ID, c.Country_Description FROM user_detail u JOIN country c ON u.Country = c.ID WHERE User_ID = 'logged[user_ID]'");

 

Then on the profile page I do this Country: $loggedUserCountry

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.