Skip to content

Instantly share code, notes, and snippets.

@ErikRamses
Created September 12, 2013 13:02
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/6536922 to your computer and use it in GitHub Desktop.
Save ErikRamses/6536922 to your computer and use it in GitHub Desktop.
Servidor Aplicacion
<?php
// array for JSON response
$response = array();
$Camion = $_POST['Camion'];
$Ruta = $_POST['Ruta'];
$Latitud = $_POST['Latitud'];
$Longitud = $_POST['Longitud'];
//Field(s)
if (isset($Camion) && isset($Ruta) && isset($Latitud) && isset($Longitud)) {
require_once __DIR__ . '/db_connect.php';
// connecting to db
$db = new DB_CONNECT();
// mysql update row
$result = mysql_query("UPDATE RUTAS SET Latitud = $Latitud, Longitud = $Longitud WHERE Camion = '$Camion' && Ruta = '$Ruta' ");
// check if row inserted or not
if ($result) {
// successfully updated
$response["success"] = 1;
$response["message"] = " DataBase successfully updated.";
// echoing JSON response
echo json_encode($response);
} else {
}
} else {
// required field is missing
$response["success"] = 0;
$response["message"] = "Required field(s) is missing";
// echoing JSON response
echo json_encode($response);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment