php:
header("Content-type: application/json; charset=utf-8");
$response = new stdClass();
$response->page = $page;
$response->total = $total_pages;
$response->records = $count;
$l_row=0;
$l_totalamt=0;
while ($row = sqlsrv_fetch_array($stmt)){
$response->rows[$l_row]['id']=$l_rowcount+1; //set id starting from 1 instead of 0, and it's up to your choice.
$response->rows[$l_row]['cell']=array(
$row['inv_id'],
$row['descp'],
$row['amt']
);
$l_totalamt+=$row['amt'];
$l_row++;
}
sqlsrv_free_stmt( $stmt);
$response->userdata['amt']=$l_totalamt;
echo json_encode($response);
No comments:
Post a Comment