<?php
//header('Content-Type: application/json');
include 'include/db.php';
/*echo '<pre>';
print_r($_REQUEST);
*/
$id=$_REQUEST['user_id'];
$all_id_array=explode(',',$id);

$result = "'" . implode ( "', '", $all_id_array ) . "'";

for($i=1;$i<=12;$i++)
{
    if(strlen($i)<2)
    {
      $month='0'.$i;
    }
    else
    {
      $month=$i;
    }
    $year=$_REQUEST['year'];
    $xyz=$year.'-'.$month;
    // echo  $query="select unique_user_id,count(created_date) as number from registration where unique_user_id in ($aa) and created_date like '%$xyz%' 
    $query="select unique_user_id,count(created_date) as number from registration where unique_user_id in ($result) and created_date like '%$xyz%' 
    order by created_date desc";
    $connection=mysqli_query($conn,$query);
    $no=mysqli_num_rows($connection);
    if($no>0)
    {
        while($rows=mysqli_fetch_array($connection))
        {
          // $number[$mnth[$i-1]]=$rows['number'];    //  create associative array
           $number[]=$rows['number'];
           //echo $rows['unique_user_id'];
        }
    }
}
echo json_encode($number);
?>