<?php

require 'db.php';

$sql = "SELECT * FROM orders";
$result = mysqli_query($con,$sql);
while($rows = mysqli_fetch_assoc($result))
{
    $cat =  $con->query("select name from user where id=".$rows['uid']."");
	if($row = $cat->fetch_assoc())
	$p['name'] = $row['name'];
	$p['date'] = $rows['order_date'];
	$p['time'] = $rows['timesloat'];
	$p['order_id'] = $rows['id'];
	$p['pay_mode'] = $rows['p_method'];
	$p['product_name'] = explode("$;",$rows['pname']);
	$p['product_price'] =explode("$;",$rows['pprice']); 
	$p['product_type'] =explode("$;",$rows['ptype']);
	$p['product_qty'] =explode("$;",$rows['qty']);
	$p['status'] = $rows['status'];
	$p['total_amount'] = $rows['total'];
	$p['cooking'] = $rows['cooking_ins'];
	$ad =  $con->query("select * from address where id=".$rows['address_id']."");
	if($row1 = $ad->fetch_assoc())
	$p['address'] = $row1['hno'].','.$row1['society'].','.$row1['landmark'].','.$row1['area'].','.$row1['pincode'];
    $pending_orders[] = $p;
}

echo json_encode($pending_orders);


?>