<?php 
include_once 'db_functions.php'; 
$db = new DB_Functions(); 
$json = $_POST["soJSON"];
if (get_magic_quotes_gpc()){ 
	$json = stripslashes($json); 
}
//Decode JSON into an Array 
$data = json_decode($json,true);  
//Util arrays to create response JSON 
$a=array();
$unamee = $data["uname"];
$uidd = $data["uid"];
$retailerCodee = $data["retailerCode"];
$prodListt = $data['prodList'];
$latitude = $data['latitude'];
$longitude = $data['longitude'];
$address = $data['address'];
$distance = $data['distance'];
$imei = $data['imei'];
$modelid = $data['model_id'];
//// get retailer basic details
$res_loc = $db->getLocationDetail($retailerCodee);
$row_loc = mysql_fetch_array($res_loc);
//// store in db
$res = $db-> createSO($prodListt,$retailerCodee,$uidd,$unamee,$row_loc["addrs"],$latitude,$longitude,$address,$distance,$imei,$modelid);
//Based on inserttion, create JSON response     
array_push($a,$res);

echo json_encode($a); 
?>