[thelist] query or php with a join

Andrew andrew at humanbehaviour.co.uk
Fri Feb 28 09:10:00 CST 2003


PHP Guys & Dolls I have a sight display issue that I just need to resolve :)

After a select I end up with a record = 9 but I want to display the record as
the name not the value.

The value was inserted as a value so I need to make a join to the original table
in the query, but alas I have tried a few things without any luck.  So it's the
experts whom I need to help out:)

The query is:

$result=mysql_query("SELECT items.ItemSKU, items.ItemName,
items.ItemDescription, items.PostCode, items.Category, items.CityID,
items.CTelephone, items.ItemID, items.Cfax, items.Cemail, items.Caddress,
items.CTown, items.Cwww FROM items WHERE CityID='$CityID' ORDER BY CityID");

while ($row  =  mysql_fetch_row($result)) {

$City=$row['5'];
        }

the display is:

<? echo "$City";

So I need to create a query that then joing the CityID from items to the
CityName in table city.  Or is it the php that needs to be altered?

Andrew




More information about the thelist mailing list