1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
include_once('db_config.inc.php');
$cfg_db_host = $host;
$cfg_db_db = $base;
$cfg_db_user = $user;
$cfg_db_password = $password;
/*
if(isset($_POST['id'])) $id = $_POST['id'];
$id = 0;
if(isset($_POST['data'])) $data = $_POST['data'];
$data = 0;
*/
try{
$conn = new PDO('mysql:host='.$cfg_db_host.';charset=utf8;dbname='.$cfg_db_db, $cfg_db_user , $cfg_db_password);
}
catch (Exception $e){echo json_encode(array("retour"=>'Erreur de connexion à la bdd', "e" => $e )); die();}
try{
$req = $conn->prepare('UPDATE geofences SET devise_id = :devise_id, type = :type, coordinates=:coordinates WHERE id = :id');
$req->execute(array(
'devise_id' => 1,
'type' => "tuuupe",
'coordinates' => 'coooooord',
'id' => 1
));
}
catch (Exception $e){echo json_encode(array("retour"=>'Erreurrrr update saveGeofences', "e" => $e )); die();}
echo json_encode($req); |
Partager