在显示数据库中的日期之后显示日期范围

时间:2019-05-11 08:54:48

标签: php html codeigniter date

我有MySql数据库“ emutu”和表“ surveilans”

我已经设置了控制器“ Surveilans.php”

public function surveilans_lantai3() {
    $data['surveilans_lantai3'] = $this->m_surveilans->get_surveilanslt3();
    $data['title'] = "Surveilans Rawat Inap Lantai 3";
    $data['view'] = "surveilans_lantai3";
    $this->load->view('header',$data);
}

我已经建立了模型“ m_surveilans.php”

public function get_surveilanslt3($id = false)
{
    if($id === false)
    {
        //$this->db->where('id_user = 1');
        $this->db->order_by('tanggal','ASC');
        $this->db->where('unit', 'Rawat Inap Lt.3');
        $query = $this->db->get('surveilans');
        return $query->result_array();
    }
    $this->db->order_by('tanggal','ASC');
    $this->db->where('unit', 'Rawat Inap Lt.3');
    $query = $this->db->get_where('surveilans', array('id_surveilans' => $id));
    return $query->row_array();
}

然后查看“ surveilans_lantai3.php”

<tbody>
        <?php foreach ($surveilans_lantai3 as $list): ?>
            <tr>
                <td style="vertical-align: middle; text-align: center"><?php echo $list['unit']; ?></td>
                <td style="vertical-align: middle; text-align: center"><?php echo $list['tanggal']; ?></td>
                <td style="vertical-align: middle; text-align: center"><a href="#"><u><?php echo $list['jml_pasien']; ?></u></a></td>
                <td style="vertical-align: middle; text-align: center"><?php echo $list['venaperifer_phlebitis']; ?></td>
                <td style="vertical-align: middle; text-align: center"><?php echo $list['jml_phlebitis']; ?></td>
                <td style="vertical-align: middle; text-align: center"><?php echo $list['kateter_isk']; ?></td>
                <td style="vertical-align: middle; text-align: center"><?php echo $list['jml_isk']; ?></td>
                <td style="vertical-align: middle; text-align: center"><?php echo $list['kasus_ilo']; ?></td>
                <td style="vertical-align: middle; text-align: center"><?php echo $list['jml_ilo']; ?></td>
                <td style="vertical-align: middle; text-align: center"><?php echo $list['kateter_iadp']; ?></td>
                <td style="vertical-align: middle; text-align: center"><?php echo $list['jml_iadp']; ?></td>
                <td style="vertical-align: middle; text-align: center"><?php echo $list['ventilator_hap']; ?></td>
                <td style="vertical-align: middle; text-align: center"><?php echo $list['jml_hap']; ?></td>
            </tr>
        <?php endforeach; ?>
        </tbody>

问题: 在不设置控制器的情况下如何显示数据库后的日期范围?

谢谢

0 个答案:

没有答案