Created
September 12, 2013 13:02
-
-
Save ErikRamses/6536922 to your computer and use it in GitHub Desktop.
Servidor Aplicacion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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