<?php
include_once 'db_functions.php'; 
$db = new DB_Functions(); 
$json = $_POST["taskJSON"];
if (get_magic_quotes_gpc()){ 
	$json = stripslashes($json); 
}
//Decode JSON into an Array 
$data = json_decode($json); 
//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_task($data[$i]->refid,$data[$i]->refno,$data[$i]->user_id,$data[$i]->remark,$data[$i]->status,$data[$i]->image_name,$data[$i]->latitude,$data[$i]->longitude,$data[$i]->address,$data[$i]->distance,$data[$i]->imei,$data[$i]->model_id);
	//Based on inserttion, create JSON response     
 	array_push($a,$res);  
}
//Post JSON response back to Android Application 
echo json_encode($a); 
?>


