Skip to content

Instantly share code, notes, and snippets.

@ErikRamses
Created September 12, 2013 13:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ErikRamses/6537004 to your computer and use it in GitHub Desktop.
Save ErikRamses/6537004 to your computer and use it in GitHub Desktop.
Obtener posición
<?php
$response = array();
require_once __DIR__ . '/db_connect.php';
$db = new DB_CONNECT();
$result = mysql_query("SELECT * FROM RUTAS") or die(mysql_error());
if (mysql_num_rows($result) > 0) {
$response["results"] = array();
while ($row = mysql_fetch_array($result)) {
// temp user array
$ruta = array();
$ruta["Ruta"] = $row["Ruta"];
$ruta["Camion"] = $row["Camion"];
$ruta["Lat"] = $row["Latitud"];
$ruta["Lng"] = $row["Longitud"];
array_push($response["results"], $ruta);
}
$response["success"] = 1;
echo json_encode($response);
} else {
$response["success"] = 0;
$response["message"] = "Not found";
echo json_encode($response);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment