0 AND MAP_REG_ID='".$REG_ID."' ORDER BY MAP_ID"; $conn->query($query); $MAPLOCID = ""; $MAPOBJNAME = "&"; $MAPOBJCOORD = "&"; $firstElement = true; $nextVal = ""; while($conn->next_record()) { if ($firstElement) $firstElement = false; else $nextVal = "|"; $MAPLOCID.= $nextVal.$conn->field_value("MAP_LOC_ID"); $MAPOBJCOORD.= $nextVal.$conn->field_value("MAP_LATITUDE").";".$conn->field_value("MAP_LONGITUDE"); //---- get location names $query = "SELECT LOC_NAME FROM localities WHERE LOC_ID='".$conn->field_value("MAP_LOC_ID")."'"; $conn2->query($query); $conn2->next_record(); if ($conn2->field_value("LOC_NAME")) $MAPOBJNAME.= $nextVal.urldecode($conn2->field_value("LOC_NAME")); else $MAPOBJNAME.= $nextVal."-"; } //---- get Data from DB (touristic regions) $query = "SELECT * FROM touristicregionslocalities WHERE TRL_REG_ID='".$REG_ID."'"; $conn->query($query); while($conn->next_record()) { if ($firstElement) $firstElement = false; else $nextVal = "|"; $MAPLOCID.= $nextVal.$conn->field_value("TRL_LOC_ID"); $query2 = "SELECT * FROM maps WHERE MAP_LOC_ID='".$conn->field_value("TRL_LOC_ID")."'"; $conn2->query($query2); if ($conn2->next_record()) $MAPOBJCOORD.= $nextVal.$conn2->field_value("MAP_LATITUDE").";".$conn2->field_value("MAP_LONGITUDE"); else $MAPOBJCOORD.= $nextVal."0;0"; //---- get location names $query2 = "SELECT LOC_NAME FROM localities WHERE LOC_ID='".$conn->field_value("TRL_LOC_ID")."'"; $conn2->query($query2); $conn2->next_record(); if ($conn2->field_value("LOC_NAME")) $MAPOBJNAME.= $nextVal.urldecode($conn2->field_value("LOC_NAME")); else $MAPOBJNAME.= $nextVal."-"; } print $MAPLOCID; print utf8_decode($MAPOBJNAME); print $MAPOBJCOORD; ?>