--- a/betweenpoint.delete.php
+++ b/betweenpoint.delete.php
@@ -13,6 +13,20 @@
echo("Error in SQL query: " . pg_last_error() . "
\n");
} else {
echo "Deleted {$_REQUEST['oldgeopo']}
";
+ $updatedroutes = 0;
+ $result_outdatedroutes = pg_query($conn, "Select * FROM between_stops where points LIKE '%" . $_REQUEST['oldgeopo'] . ";%'");
+ while ($outdatedroute = pg_fetch_assoc($result_outdatedroutes)) {
+ $newpoints = str_replace($_REQUEST['oldgeopo'].';', '', $outdatedroute['points']);
+ $sql = "UPDATE between_stops set points='$newpoints' where fromlocation = '{$outdatedroute['fromlocation']}' AND tolocation = '{$outdatedroute['tolocation']}' ";
+ $result = pg_query($conn, $sql);
+ if (!$result) {
+ echo("Error in SQL query: " . pg_last_error() . "
\n");
+ }
+ echo "updated ".$outdatedroute['fromlocation']."->".$outdatedroute['tolocation']."
";
+
+ $updatedroutes++;
+ }
+ echo "updated $updatedroutes routes
";
}
}
flush();