<?php
include '../config.php';
$condX = $_POST['condX'];
$time = $_POST['timeVal'];
$comment_arr = array();
$comment_arr1 = array();
$comment_arr2 = array();
$key_arr = array();
$key_arr2 = array();
$timeZ = "('".implode("','",$time)."')";
//echo $timeZ;

$dealers = mysqli_query($conn,"SELECT * FROM `action` WHERE `Quarter` IN $timeZ AND $condX ORDER BY `s_no` ASC ");
//echo "SELECT * FROM `action` WHERE $condX ORDER BY DESC ";
//echo "SELECT * FROM `action` WHERE $condX ";
if(mysqli_num_rows($dealers) > 0){
    while($row = mysqli_fetch_array($dealers)){
        $var1 = $row['Comments']; 
        $var2 = $row['s_no'];
        array_push($comment_arr1,$var1);
        array_push($key_arr2,$var2);
    }
}
else
{
    $comment_arr1 = array();
}

$comment_arr['comment1'] = $comment_arr1;
$comment_arr['key2'] = $key_arr2;

$dealers = mysqli_query($conn,"SELECT * FROM `action2` WHERE `Quarter` IN $timeZ AND $condX ORDER BY `s_no` ASC ");
//echo "SELECT * FROM `action2` WHERE $condX ORDER BY `s_no` ASC";
//echo "SELECT * FROM `action` WHERE $condX ";
if(mysqli_num_rows($dealers) > 0){
    while($row = mysqli_fetch_array($dealers)){
        $var1 = $row['Comments']; 
        $var2 = $row['s_no'];
        array_push($comment_arr2,$var1);
        array_push($key_arr,$var2);
    }
}
else
{
    $comment_arr2 = array();
}

$comment_arr['comment2'] = $comment_arr2;
$comment_arr['key'] = $key_arr;


echo json_encode($comment_arr);
?>