无法更新约会

时间:2016-10-15 18:43:15

标签: php

那是我的更新php代码。这是我的代码中的任何错误。因为它总是显示

  

{"成功":0,"消息":"缺少必填字段"}

<?php

 include 'connection.php';

 $response = array();   
 if (isset($_POST['appointmentID']) &&
 isset($_POST['visitName']) && isset($_POST['description']) &&
 isset($_POST['appointmentTime']) && isset($_POST['appointmentDate'])) 
 {

     $appointmentID = $_POST['appointmentID'];
     $visitName = $_POST['visitName'];
     $Description = $_POST['Description'];
     $appointmentTime = $_POST['appointmentTime'];
     $appointmentDate = $_POST['appointmentDate'];

     $conn = new mysqli($hostname_localhost, $username_localhost, $password_localhost, $database_localhost);

     $sql ="UPDATE APPOINMENT SET visitName = '$visitName', Description =     '$Description', appointmentTime = '$appointmentTime', appointmentDate = '$appointmentDate' WHERE appointmentID =
 '$appointmentID'";
      if ($conn->query($sql) === TRUE) 
      {

         $response["success"] = 1;
         $response["message"] = "Feedback successfully submitted!"; 
         // echoing JSON response
         echo json_encode($response);   
      }  
      else 
      {
         $response["success"] = 0;
         $response["message"] = "Oops! An error occurred.";

         echo json_encode($response);
      } 
 } else  {
     $response["success"] = 0;
     $response["message"] = "Required field(s) is missing";

     echo json_encode($response); 
 }

?>

0 个答案:

没有答案