Jump to content

Getting current month and displaying result on Chart


Go to solution Solved by 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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.