jamesmva

Untitled

Jan 4th, 2017
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.53 KB | None | 0 0
  1.     header('Content-Type: application/json');
  2.     include("includes/db.php");
  3.  
  4.     if(isset($_GET['action'])){
  5.        
  6.         $action = $_GET['action'];
  7.         $orderId = $_GET['orderId'];
  8.  
  9.         $sql = "UPDATE order_list
  10.                 SET status ='$action'
  11.                 WHERE order_list.Oid ='$orderId' ";
  12.  
  13.         $run_iupdate = mysqli_query($conn,$sql) or die("error");
  14.  
  15.         $query = "SELECT *
  16.              FROM order_list
  17.              WHERE order_list.Oid ='$orderId' ";
  18.  
  19.         $run_item = mysqli_query($conn,$query);
  20.         while($rows = mysqli_fetch_assoc($run_item)){
  21.        
  22.         $Order_stats = $rows['status'];
  23.         $orderId  = $rows['Oid'];
  24.         }
  25.  
  26.     }
  27.        
  28.  
  29.  
  30.        
  31.        
  32.         if( $Order_stats == 0){
  33.             $status = '<span class="label label-danger flatred" product_id="'.$orderId .'"> Aguardando aprovação</span>';
  34.         }
  35.         elseif ($Order_stats == 1) {
  36.             $status = '<span class="label label-success " product_id="'.$orderId .'"> Confirmado !</span>';
  37.         }
  38.          elseif ($Order_stats == 2) {
  39.             $status = '<span class="label label-warning " product_id="'.$orderId .'"> Em produção !</span>';
  40.         }
  41.         elseif ($Order_stats == 3) {
  42.             $status = '<span class="label label-primary " product_id="'.$orderId .'"> Encaminhando </span>';
  43.         }
  44.         elseif ($Order_stats == 4) {
  45.             $status = '<span class="label label-info " product_id="'.$orderId .'"> Entregue </span>';
  46.         }
  47.  
  48.        
  49.  
  50.         $result['change'] = new stdClass;
  51.         $result['statusChange'] = $status;
  52.  
  53.  
  54.         echo json_encode($result);
Advertisement
Add Comment
Please, Sign In to add comment