简体   繁体   中英

Highcharts :: Codeigniter

    <?php
for ($i= 1; $i <= 12; $i++) {
    if ( $i <= 9)  { 
    $month = '0' . $i;
    } else {
    $month = $i; 
    }
   $date = date("d");
    $year = date("Y");
    //$month = date('Y-m-d', strtotime(date('Y').'-'.$i.'-'.date('d')));
    $month = date('Y-m-d', strtotime($date."-" . $i ."-". $year));  
    $where = array('created_time >=' => $month . " 00:00:00", 'created_time <=' => $month . " 23:59:59");
    $i_result[$month] = count($this->db->where($where)->get('tbl_opportunities')->result());

}    var_dump( $i_result); 
   ?>

I am trying to generate month recap charts. It is giving me the correct result for today's stats, but for the next days the stats refresh and give the new stats. But I would like to have a cumulative of total result for that particular month (monthly basic). Any suggestions?..

Refer to the image - just the blue bar:

在此处输入图片说明

manage to solve the problem...Tq

by replace this line

$where = array('created_time >=' => $month . " 00:00:00", 'created_time <=' => $month . " 23:59:59");

to

$where = array('created_time >=' => $year . "-" . '0' . $i . '-' . '01', 'created_time <=' => $year . "-" . '0' . $i . '-' . '31');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM