<?php 
require_once '../../includes/conn.php';

$valid['success'] = array('success' => false, 'messages' => array());

$orderId = $_POST['orderId'];

if($orderId) { 

 $sql = "delete from orders WHERE order_id = {$orderId}";
 $orderItem = "delete from order_item  WHERE  order_id = {$orderId}";
 $orderItemAll = "delete from order_item_all  WHERE  order_id = {$orderId}";
 $OrderDetails = "delete from orders_details  WHERE  order_id = {$orderId}";

 if($con->query($sql) === TRUE  &&  $con->query($orderItem) === TRUE    &&  $con->query($orderItemAll) === TRUE    &&  $con->query($OrderDetails) === TRUE  ) {
 	$valid['success'] = true;
	$valid['messages'] = "Permanently Successfully Delete";		
 } else {
 	$valid['success'] = false;
 	$valid['messages'] = "Error while remove the brand";
 }
 
 $con->close();

 echo json_encode($valid);
 
} // /if $_POST

?>