Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

php code to display countries and regions

Status
Not open for further replies.

adrianuk29

Technical User
Feb 20, 2004
1
GB
I need a bit of help, if anyone can help me. I have been scratching my head for the last few hours. I am trying to list the countries with the regions from my database. At present I am getting the country and only one region. I need to display all the regions. Here is the output I recieve form my php page.

Australia
Queensland (2)

Canary Islands
Tenerife (5)

Croatia
Dalmatia (1)

In Canary Islands I have at least another two regions that should be displayed at the moment it is only showing tenerife.

Here is my code, I hope someone can help me. Many thanks.

$query = "SELECT property_location,property_region,
count(property_region) AS cnt
FROM property_data GROUP BY property_location";

$res = mysql_query($query) or die(mysql_error());
if(mysql_num_rows($res) > 0) {
while($row=mysql_fetch_array($res)) { ?>
<font face=arial size=2><? echo $row['property_location']; ?></a> <br><? echo $row['property_region']; ?> (<? echo $row['cnt']; ?> )</font><br>
<br>
<? }
}
else {
echo &quot;Nothing found&quot;
} ?>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top