$i) $Canada_cities[$k]["offers"] = get_data("SELECT * FROM tbl_offer WHERE city_id=$k", "offer_id", "title"); // America $country_id_arr = get_one_data("SELECT country_id FROM tbl_country WHERE name='America'"); $country_id = $country_id_arr["country_id"]; $America_cities = get_data("SELECT city_id, name FROM tbl_city WHERE country_id=$country_id", "city_id"); foreach ($America_cities as $k => $i) $America_cities[$k]["offers"] = get_data("SELECT * FROM tbl_offer WHERE city_id=$k", "offer_id", "title"); // Europe $country_id_arr = get_one_data("SELECT country_id FROM tbl_country WHERE name='Europe'"); $country_id = $country_id_arr["country_id"]; $Europe_cities = get_data("SELECT city_id, name FROM tbl_city WHERE country_id=$country_id", "city_id"); foreach ($Europe_cities as $k => $i) $Europe_cities[$k]["offers"] = get_data("SELECT * FROM tbl_offer WHERE city_id=$k", "offer_id", "title"); // Caribbean $country_id_arr = get_one_data("SELECT country_id FROM tbl_country WHERE name='Caribbean'"); $country_id = $country_id_arr["country_id"]; $Caribbean_cities = get_data("SELECT city_id, name FROM tbl_city WHERE country_id=$country_id", "city_id"); foreach ($Caribbean_cities as $k => $i) $Caribbean_cities[$k]["offers"] = get_data("SELECT * FROM tbl_offer WHERE city_id=$k", "offer_id", "title"); $tpl->assign("Canada_cities", $Canada_cities); $tpl->assign("America_cities", $America_cities); $tpl->assign("Europe_cities", $Europe_cities); $tpl->assign("Caribbean_cities", $Caribbean_cities); $tpl->display("template.sitemap.php"); ?>