Snippet Untitled
3 months ago
            <?php
...
$this->db->select('SUM(peminjaman_buku) AS total');
$this->db->from('table_arus_stok');
$this->db->join('table_peminjaman', 'table_arus_stok.tgl_peminjaman = table_peminjaman.tgl_peminjaman ', 'inner');
$this->db->where('table_peminjaman.tgl_peminjaman >=', date('Y-m').'-01');
$this->db->where('table_peminjaman.tgl_peminjaman <=', date('Y-m-t', strtotime(date('Y-m-d'))));
$this->db->limit(1);
echo $this->db->get()->row()->total;
        
add