--- a/myway/myway_timeliness_reconcile.php +++ b/myway/myway_timeliness_reconcile.php @@ -1,31 +1,46 @@ $value) { - if (strstr($key, "route") && !strstr($value, "Select")) { - $myway_route = str_replace("route", "", $key); - $route_full_name = $value; - $query = "update myway_routes set route_full_name = :route_full_name where myway_route = :myway_route"; - debug($query, "database"); - $query = $conn->prepare($query); - $query->bindParam(":myway_route", $myway_route,PDO::PARAM_STR, 5); - $query->bindParam(":route_full_name", $route_full_name,PDO::PARAM_STR, 42); - $query->execute(); - die(print_r($conn->errorInfo() , true)); - } - if (strstr($key, "myway_stop")) { - $myway_stop = $value; - $stop_code = $_REQUEST['stop_code']; - $stop_street = $_REQUEST['stop_street']; - $query = "update myway_stops set stop_code = :stop_code, stop_street = :stop_street where myway_stop = :myway_stop"; - debug($query, "database"); - $query = $conn->prepare($query); - $query->bindParam(":myway_stop", $myway_stop, PDO::PARAM_STR, 25); - $query->bindParam(":stop_code", $stop_code, PDO::PARAM_STR, 32); - $query->bindParam(":stop_street", $stop_street); - $query->execute(); - die(print_r($conn->errorInfo() , true)); - } + if (strstr($key, "route") && !strstr($value, "Select")) { + $myway_route = str_replace("route", "", $key); + $route_full_name = $value; + $query = "update myway_routes set route_full_name = :route_full_name where myway_route = :myway_route"; + debug($query, "database"); + $query = $conn->prepare($query); + $query->bindParam(":myway_route", $myway_route, PDO::PARAM_STR, 5); + $query->bindParam(":route_full_name", $route_full_name, PDO::PARAM_STR, 42); + $query->execute(); + die(print_r($conn->errorInfo(), true)); + } + if (strstr($key, "myway_stop")) { + $myway_stop = $value; + $stop_code = $_REQUEST['stop_code']; + $stop_street = $_REQUEST['stop_street']; + $query = "update myway_stops set stop_code = :stop_code, stop_street = :stop_street where myway_stop = :myway_stop"; + debug($query, "database"); + $query = $conn->prepare($query); + $query->bindParam(":myway_stop", $myway_stop, PDO::PARAM_STR, 25); + $query->bindParam(":stop_code", $stop_code, PDO::PARAM_STR, 32); + $query->bindParam(":stop_street", $stop_street); + $query->execute(); + die(print_r($conn->errorInfo(), true)); + } } include_header("MyWay Data Reconcile", "mywayTimeRec"); // initialise @@ -38,7 +53,7 @@ )"); echo "$count new stops.
"; if (!$count) { - print_r($conn->errorInfo()); + print_r($conn->errorInfo()); } $count = $conn->exec("insert into myway_routes select distinct myway_route from myway_observations WHERE myway_route NOT IN @@ -48,39 +63,39 @@ )"); echo "$count new routes.
"; if (!$count) { - print_r($conn->errorInfo()); + print_r($conn->errorInfo()); } echo "

Stops

"; -/*stops - search start of name, display map and table nuimbered, two text boxes */ +/* stops + search start of name, display map and table nuimbered, two text boxes */ $query = "Select * from myway_stops where stop_code is NULL and stop_street is NUll;"; debug($query, "database"); $query = $conn->prepare($query); $query->execute(); if (!$query) { - databaseError($conn->errorInfo()); - return Array(); + databaseError($conn->errorInfo()); + return Array(); } foreach ($query->fetchAll() as $myway_stop) { - echo "

{$myway_stop[0]}

"; - $stopNameParts = explode(" ", $myway_stop[0]); - $markers = array(); - $stopKey = 1; - $foundStops = getStops(false, "", $stopNameParts[0] . " " . $stopNameParts[1]); - if (sizeof($foundStops) > 0) { - echo ""; - foreach ($foundStops as $stopResult) { - $markers[] = array( - $stopResult['stop_lat'], - $stopResult['stop_lon'] - ); - echo ""; - } - echo '
" . $stopKey++ . "" . $stopResult['stop_name'] . "" . $stopResult['stop_code'] . "
'; - echo "" . staticmap($markers, 0, "icong", false) . "
\n"; - } - echo '
- + echo "

{$myway_stop[0]}

"; + $stopNameParts = explode(" ", $myway_stop[0]); + $markers = array(); + $stopKey = 1; + $foundStops = getStops(false, "", $stopNameParts[0] . " " . $stopNameParts[1]); + if (sizeof($foundStops) > 0) { + echo ""; + foreach ($foundStops as $stopResult) { + $markers[] = array( + $stopResult['stop_lat'], + $stopResult['stop_lon'] + ); + echo ""; + } + echo '
" . $stopKey++ . "" . $stopResult['stop_name'] . "" . $stopResult['stop_code'] . "
'; + echo "" . staticmap($markers, 0, "icong", false) . "
\n"; + } + echo ' +
@@ -88,45 +103,45 @@
-
+
'; - echo '
'; + echo '
'; } echo '

Routes

'; -/*routes - remove alpha char, search present dropdown*/ +/* routes + remove alpha char, search present dropdown */ $query = "Select * from myway_routes where route_full_name is NUll;"; debug($query, "database"); $query = $conn->prepare($query); $query->execute(); if (!$query) { - databaseError($conn->errorInfo()); - return Array(); + databaseError($conn->errorInfo()); + return Array(); } foreach ($query->fetchAll() as $myway_route) { - echo "

{$myway_route[0]}

"; - $query = "Select * from myway_observations where myway_route = :route order by time"; - debug($query, "database"); - $query = $conn->prepare($query); - $query->bindParam(":route", $myway_route[0]); - $query->execute(); - if (!$query) { - databaseError($conn->errorInfo()); - return Array(); - } - foreach ($query->fetchAll() as $myway_obvs) { - echo $myway_obvs['myway_stop'] . $myway_obvs['time'] . "
"; - } - $searchRouteNo = preg_replace("/[A-Z]/", "", $myway_route[0]); - echo $searchRouteNo; - echo '
+ echo "

{$myway_route[0]}

"; + $query = "Select * from myway_observations where myway_route = :route order by time"; + debug($query, "database"); + $query = $conn->prepare($query); + $query->bindParam(":route", $myway_route[0]); + $query->execute(); + if (!$query) { + databaseError($conn->errorInfo()); + return Array(); + } + foreach ($query->fetchAll() as $myway_obvs) { + echo $myway_obvs['myway_stop'] . $myway_obvs['time'] . "
"; + } + $searchRouteNo = preg_replace("/[A-Z]/", "", $myway_route[0]); + echo $searchRouteNo; + echo '
"; - echo '
'; + foreach (getRoutesByNumber($searchRouteNo) as $routeResult) { + echo "\n"; + } + echo ""; + echo '
'; } include_footer(); ?>