Jump to content

Getting current month and displaying result on Chart


dapcigar

Recommended Posts

Hello all,

 

Am trying to calculate some data and display the result of the current month in a chart form. i just don't know how to get the current month. this is not working..

<?php
include('mysql_connect.php');

$date = 'MONTH(CURRENT_DATE())';
$status = 'paid';
//mysql_select_db("hyprops", $con);

$query = mysql_query("SELECT sum(amount) 'amount',  department FROM requisition WHERE status = '$status' AND  date='$date' ");

$category = array();
$category['name'] = 'department';

//$series1 = array();
//$series1['name'] = 'actual';

$series2 = array();
$series2['name'] = 'amount';

//$series3 = array();
//$series3['name'] = 'Highcharts';


while($r = mysql_fetch_array($query)) {
    $category['data'][] = $r['department'];
   // $series1['data'][] = $r['actual'];
    $series2['data'][] = $r['amount'];
  //  $series3['data'][] = $r['highcharts'];   
}

$result = array();
array_push($result,$category);
//array_push($result,$series1);
array_push($result,$series2);
//array_push($result,$series3);


print json_encode($result, JSON_NUMERIC_CHECK);

mysql_close($con);
?> 

Please how can i solve this issue?

 

Thanks in advance

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.