<?php  
 include_once 'opendb.php';
  if (isset($_POST["ReqID"]) && isset($_POST["Reply_Mess"]) )
    {       
               $ReplyMess=$_POST["Reply_Mess"];
               $ReqID=$_POST["ReqID"];
              $sql = "SELECT * FROM client_requests WHERE request_id = ".$ReqID.";";
              $result = $conn->query($sql);
              if ($result->num_rows > 0 )
              { 
               $sql = "UPDATE client_requests SET file_data=null,Reply_message='".$ReplyMess."',req_status=2 WHERE request_id=".$ReqID.";";
        
                        if ($conn->query($sql) === TRUE) {
                            echo( "Update finished");
                        } else {
                            echo( "Error updating request: " . $conn->error);
                        }
              }
              else 
              {
                  echo( "Error updating request, invalid request id " . $ReqID);
              }
              $conn->close();
    }
    
    
    
    
 ?>