Hmmm... I'm getting all the records but they're not displaying correctly. I currently have four regions and five cities spread across those different regions. With the following code, the page displays each city four times, once for each region:
PHP Code:
$result = @mysql_query("SELECT kfth_city.*, kfth_region.name as region_name from kfth_city, kfth_region WHERE $country_id = kfth_city.country_id ORDER by region_name ASC, kfth_city.name ASC");
if (!$result) {
echo("<p>Error performing query: ". mysql_error() ."</p>");
exit ();
}
while ($row = mysql_fetch_array($result)) {
$region_name = $row["region_name"];
$id = $row["id"];
$name = $row["name"];
echo "$name";
if ($region_name) {
echo " (Region: $region_name) ";
}
echo "(<a href=\"delete_city.php?id=$id\" onclick=\"return confirm_entry()\">delete</a>) (<a href=\"change_region.php?id=$id&country_id=$country_id\">change region association</a>)<br>";
}
Bookmarks