<?php
$data = array();
require 'config.php';
$sql= "select min(registration_date) as earliest_date, max(registration_date) as latest_date from mrcs";
$stmt = $pdo->prepare($sql);
$stmt->execute();
$total = $stmt->rowCount();
if($total > 0){
while ($row = $stmt->fetchObject()) {
	$edate=$row->earliest_date;
	$ldate=$row->latest_date;
	$e_date = date("M-Y", strtotime($edate));
	$l_date = date("M-Y", strtotime($ldate));
	$data['status'] = 'ok';
	$data['result'] = array(
          "earliest_date" => $e_date,
		  "latest_date" => $l_date,
        );
}
}
else{
        $data['status'] = 'err';
        $data['result'] = '';
    }
	//returns data as JSON format
    echo json_encode($data);
 ?>