<?php
header('Content-Type: application/json');

// $con = mysqli_connect("localhost", "root", "", "jibran84_ach");

$con=mysqli_connect("localhost", "jibran84_itc70kk", "Smartest1", "jibran84_cms");
if( $_GET['CustomYear'] ){
		$year = $_GET['CustomYear'];
		$start = $year."-01-01";
		$end = ++$year."-01-01";
		echo $sqlQuery = "SELECT MONTHNAME(user_status.created_at) as month, sum(new_invoice.amount) as total
FROM user_status
join new_invoice on new_invoice.id = user_status.user_id
WHERE DATE(new_invoice.dates ) > DATE_SUB( CURDATE( ) , INTERVAL 1 YEAR )
and new_invoice.dates >= '$start' AND new_invoice.dates < '$end'
and user_status.status = 'Success'
GROUP BY YEAR( user_status.created_at ) , MONTH( user_status.created_at )
  ORDER BY user_status.created_at";

	}
?>