-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate_movie.php
More file actions
40 lines (34 loc) · 1.01 KB
/
update_movie.php
File metadata and controls
40 lines (34 loc) · 1.01 KB
1
<?phpheader("Content-Type: application/json");require_once 'db.php';//Get the all response from$response = array();//Get Id//What Can be Updatedif(isset($_POST['id']) && isset($_POST['storyline']) && isset($_POST['stars']) && isset($_POST['box_office'])){ // Move In Updated $id = $_POST['id']; $storyline = $_POST['storyline']; $stars = $_POST['stars']; $box_office = $_POST['box_office']; $statment = $connection->prepare("UPDATE movies SET storyline = '$storyline', stars = '$stars', box_office = '$box_office' WHERE id = '$id'"); if ($statment->execute()){ // SUCCESS $response['error'] =false; $response['message'] = "Movie was successfully Updated"; }else{ // Failed $response['error'] =false; $response['message'] = "Movie Failed To Update"; } }else{// We dont have any updated $response['error'] =true; $response['message'] = "Please Provide Us With Id";}echo json_encode($response);/*1. End Point -> /Update_movie.php2. Request Type : $_POST3. id, storyline, box_office, stars */