[英]Checking room availability using codeigniter query
I am new to codeigniter.我是 codeigniter 的新手。 Now I am developing a hotel room booking system.现在我正在开发一个酒店房间预订系统。 Now I am facing some issues in checking the availability of rooms while booking.现在我在预订时检查房间的可用性时遇到了一些问题。
My Query for checking room availability我的查询检查房间可用性
$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.