繁体   English   中英

使用 codeigniter 查询检查房间可用性

[英]Checking room availability using codeigniter query

我是 codeigniter 的新手。 现在我正在开发一个酒店房间预订系统。 现在我在预订时检查房间的可用性时遇到了一些问题。

预订表数据库结构

我的查询检查房间可用性

$cindt = $this->input->post('myCheckInDate');
$coutdt = $this->input->post('myCheckOutDate');
$roomid = $this->input->post('room');
$this->db->select('*');
$this->db->from('booking');
$this->db->where("b_room", $roomid);
       $this->db->where('b_cin <= ',$cindt);
       $this->db->where('b_cout <= ',$cindt);
       $this->db->where('b_cout >= ',$coutdt);  
       $this->db->where('b_cin >= ',$coutdt);       
            $query = $this->db->get();
            $nn=$query->result_array(); 
                        //print_r($nn); exit();

    if($nn){
        $this->session->set_flashdata('yes', 'Rooms is not Available');
                    redirect($_SERVER['HTTP_REFERER']);
                }
$cindt = $this->input->post('myCheckInDate');
$coutdt = $this->input->post('myCheckOutDate');
$roomid = $this->input->post('room');

    $this->db->select('*');
    $this->db->where('b_cin >=', $cindt);
    $this->db->where('b_cout <=', $coutdt);
    $this->db->where('b_room', $roomid);
    $this->db->from('booking');
    $nn = $this->db->get()->result();

  if($nn > 0){
        $this->session->set_flashdata('yes', 'Rooms is not Available');
                    redirect($_SERVER['HTTP_REFERER']);
                }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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