Jump to content

Archived

This topic is now archived and is closed to further replies.

adwfun

Displaying data from linked tables

Recommended Posts

I have 2 tables named City and District in MySQL.
Table City fields : CityID, CityName
Table District fields : DistrictID, DistrictName, CityID

I linked District to City. When retrieving data from District Table, how could I display CityName instead of cityID ?

My codes as follow:
What's problem ?

<?php
include("connectdb.php");
$district=mysql_query("select * from District");
while ($result=mysql_fetch_array($district))
{
echo $result["DistrictID"]."<br>";
echo $result["Districtname"]."<br>";
echo $result["select Districtname, Cityname from District, City where City.CityID=District.CityID"]."<br>";
}
?>

Share this post


Link to post
Share on other sites
You're not actually issuing that query.

Share this post


Link to post
Share on other sites

×

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.