There are numbers that comes into the database and I SUM up them with SUM , getting the total amount.
Numbers come every month. How to make it so that only the amount of the current month is displayed, i.e. today is 10/1/2016 and my amount is 100, tomorrow is 2/10/2016 - the amount is 350, and on reaching the end of the month the whole amount was reset and the countdown started again? This is in the module.
public function getOrder(){ $query = $this->db->query("SELECT SUM(Sum_back) AS Sum_back, name_sender, order_id FROM `" . DB_PREFIX . "order` WHERE Sum_back > 0 GROUP BY name_sender"); return $query->rows; } this is the controller
$senders = $this->model_module_limit->getOrder(); print_r($senders);die(); $this->data['senders'] = array(); foreach ($senders as $sender){ //$senders[] = "№–".$sender['order_id']; $this->data['senders'][] = array( 'name_sender' => $sender['name_sender'], 'Sum_back' => ($sender['Sum_back']), 'order_id' => $sender['order_id'] ); } this is vyushka
<?php foreach($senders as $sender){ ?> <tr> <td class="left"><?php echo $sender['name_sender']; ?></td> <td class="left"><?php echo (date("dmY "));?></td> <?php if($sender['Sum_back']){ ?> <td class="left"><?php echo $sender['Sum_back']; ?></td> <?php } else { ?> <td class="left"><?php echo $massage?></td> <?php } ?> </tr> <?php } ?>