<?php
include_once 'db_functions.php'; 
$db = new DB_Functions(); 
$json = $_REQUEST["usersJSON"];
if (get_magic_quotes_gpc()){ 
	$json = stripslashes($json); 
}
//Decode JSON into an Array 
$data = json_decode($json); 
//print_r($data);
//Util arrays to create response JSON 
$a=array();
$b=array();

for($i=0; $i<count($data) ; $i++) {
	//Store User into MySQL DB 
	$res = $db->save_bill($data[$i]->retailer_code,$data[$i]->retailer_name,$data[$i]->billing_amt,$data[$i]->billing_date,$data[$i]->remark,$data[$i]->billing_by,$data[$i]->billing_type,$data[$i]->bill_no);
	//Based on inserttion, create JSON response     
 	array_push($a,$res);  
}
//Post JSON response back to Android Application 
echo json_encode($a); 
?>


