<?php
include('../include/connection.php');

$last_batch = "";
$sql = "select MAX(batch_id) as max_batch from stats";
                        $q=$con->select_query($sql);
                        foreach($q as $r)
                        {
                            $last_batch = $r['max_batch'];
                        }

$data_pair = array();
$sql = "select location,generation from stats where batch_id=:id";
$q=$con->select_query($sql,array(':id'=>$last_batch));
foreach($q as $r)
{
    $data_pair[] = array('location'=>$r['location'],'generation'=>$r['generation']);
}
echo json_encode(array("data_pair"=>$data_pair));
?>