--- a/betweenpoint.submit.php
+++ b/betweenpoint.submit.php
@@ -16,9 +16,11 @@
echo("Error in SQL query: " . pg_last_error() ."
\n");
}
if ($reverse === "on") {
- $p = implode(";",array_reverse(explode(";",$points))).";";
- $points = str_replace(";","",$p,1);
-$sql = "INSERT INTO between_stops ( toLocation, fromLocation, points, routes) VALUES('$from','$to','$points','$routes')";
+ $ep = explode(";",$points);
+ $epr = array_reverse($ep);
+ $p = implode(";",$epr).";";
+ $pointsString = substr($p,1);
+$sql = "INSERT INTO between_stops ( toLocation, fromLocation, points, routes) VALUES('$from','$to','$pointsString','$routes')";
$result = pg_query($conn, $sql);
if (!$result) {
echo("Error in SQL query: " . pg_last_error() ."
\n");