| ".$i." | ";
echo "".$f1["travel_mode"]." | ";
echo "".($f1["distance"]<1000 ? $f1["distance"] : sprintf("%0.01fk",$f1["distance"]/1000.0))."m | ";
echo "".gmdate("H:i:s", $f1["duration"])." | ";
echo "".$f1["html_instructions"]." | ";
echo "".$f1["num_stops"]." | ";
echo "".$f1["line"]." | ";
echo "".$f1["vehicle"]." | ";
echo "".$f1["departure_stop"]." | ";
echo "".$f1["arrival_stop"]." | ";
$q2 = "SELECT * FROM leg_step_quote WHERE google_directions_leg_step_id=".$f1["sid"];
$r2 = pg_query($q2);
$f2 = pg_fetch_assoc($r2);
if (is_array($f2) && isset($f2["fare"]) && $f2["fare"]!="") {
echo " | ";
echo "".sprintf("%0.03f",$f1["location_start_lat"]).",".sprintf("%0.03f",$f1["location_start_lng"]);
echo " ".sprintf("%0.03f",$f1["location_end_lat"]).",".sprintf("%0.03f",$f1["location_end_lng"])." | ";
$fare += $f2["fare_raw"];
} else if (strtolower($f1["vehicle"])=='bus' || strtolower($f1["vehicle"])=='subway' || strtolower($f1["vehicle"])=='scooter') {
echo " | ";
echo "".sprintf("%0.03f",$f1["location_start_lat"]).",".sprintf("%0.03f",$f1["location_start_lng"]);
echo " ".sprintf("%0.03f",$f1["location_end_lat"]).",".sprintf("%0.03f",$f1["location_end_lng"])." | ";
} else {
echo "N/A | N/A";
}
echo " |
\n";
$i++;
}
if ($fare==0) $fare = $f0["fare_raw"];
echo "