簡體   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