$_POST['lens'], ':legende' => $_POST['legende'], ':copyright' => $_POST['copyright'], ':title' => $_POST['title'], ':creator' => $_POST['creator'], ':keywords' => $_POST['keywords'], ':id' => $_POST['id'] ); $query = " UPDATE photos SET lens = :lens, legende = :legende, copyright = :copyright, title = :title, creator = :creator, keywords = :keywords WHERE id = :id "; // echo $query; // print_r($data); $statement = $conn->prepare($query); $statement->execute($data); echo json_encode($_POST); } catch(PDOException $e) { echo $e->getMessage(); } } if($_POST['action'] == 'delete') { $query = " DELETE FROM photos WHERE id = '".$_POST["id"]."' "; $statement = $conn->prepare($query); $statement->execute(); echo json_encode($_POST); } ?>