0) { while ($row = @mysqli_fetch_assoc($result)) { $net_value= (float)$row['item_rate']; // error_log('net_value'.$net_value); $qty= (float)$row['unit']; // error_log('qty'.$qty); $indent_qty= (float)$row['indent_qty']; if( $qty!=0){ $item_price = (float)($net_value/$qty); $total+= (float)($item_price*$indent_qty); error_log('indent item :'.$row['item_id'].' unit price :'.$item_price.' current budget req :'.$total); }} } else { $data['status'] = 200; $data['message'] = "Data not found!"; } $data['year']=$year; $data['total_pending_indent_budget']=round($total,2); echo json_encode($data); ?>