<?php
include("db_functions.php");
$db=new DB_Functions();
///// extract requested variable of task ref no.
$refid = $_REQUEST['refid']; 
$th = $db->taskHistory($refid);
///// initialize array
$a=array();
$b=array();
///// check query execution
if($th != false){
	///// get all work done on requested task
	while($row = mysqli_fetch_array($th)) {
		$b["ref_id"] = $row["id"];
		$b["remark"] = $row["remark"];
		$b["status"] = $row["status"];
		$b["updatedate"] = $row["updatedate"];
		$b["address"] = $row["address"];
		if($row["image_name"]){
			$b["imgurl"] = "http://geeranishop.com/SALEAPI/taskImages/".$row["image_name"];
		}else{
			$b["imgurl"] = null;
		}
		array_push($a,$b);
	}
	echo json_encode($a);
} 
echo json_encode($a);
?>