<?php
include "../config.php";

$data = array();
$data2 = array();
$data3 = array();

$monthQ = mysqli_query($conn,"SELECT DISTINCT `Month` FROM m1 ORDER BY `Month` DESC LIMIT 2");
if (mysqli_num_rows($monthQ) > 0) {
    while ($row = mysqli_fetch_assoc($monthQ)) {
        array_push($data2,$row['Month']);
    }
}

$monthQ = mysqli_query($conn,"SELECT DISTINCT `Month` FROM m1 ORDER BY `Month` ASC");
if (mysqli_num_rows($monthQ) > 0) {
    while ($row = mysqli_fetch_assoc($monthQ)) {
        array_push($data3,$row['Month']);
    }
}
$data['Month_1'] = $data2;
$data['Month_2'] = $data3;

echo json_encode($data);

?>