<?php 

require 'db.php';
// $data = json_decode(file_get_contents('php://input'), true);
 
// $uid = $data['uid'];
// if($uid == '')
// {
// 	$returnArr = array("ResponseCode"=>"401","Result"=>"false","ResponseMsg"=>"Something Went wrong  try again !");
// }

$sels = $con->query("select * from coupon_code");
while($rows = $sels->fetch_assoc())
{
        $p['id'] = $rows['id'];
		$p['name'] = $rows['name'];
		$p['discount'] = $rows['discount'];
		$p['code'] = $rows['code'];
		$p['max_order_amount'] = $rows['max_order_amount'];
		$p['max_discount_amount'] = $rows['max_discount_amount'];
		$p['max_use_limit'] = $rows['max_use_limit'];
		$p['status'] = $rows['status'];
		$cp[] = $p;
}

echo json_encode($cp);
?>