Got a few tables, how do i join the information on 1 page?
Posted: Tue Mar 23, 2004 12:34 am
Hello,
I have a page which is suppose to show information from the database with multiple tables.
How do i use join for these 2 tables to show the info on one page?
Here is my original code:
and im using to display any field.
Just in case you're wondering this is not the full code...
it works just fine.
Now if i wanted to get the info from 2 tables i tried:
Doesn't work... and also how do i display it once i get it going?
Maybe something like this
Let me know what u think.
I have a page which is suppose to show information from the database with multiple tables.
How do i use join for these 2 tables to show the info on one page?
Here is my original code:
Code: Select all
$result = mysql_query("SELECT * FROM list",$db);
while ($info = mysql_fetch_array($result))Code: Select all
echo $info['name'];Just in case you're wondering this is not the full code...
it works just fine.
Now if i wanted to get the info from 2 tables i tried:
Code: Select all
$result = mysql_query("SELECT * FROM list,cities WHERE cities.id list.id=$id",$db);
$info = mysql_fetch_array($result);Maybe something like this
Code: Select all
echo $info['cities.id'];