【发布时间】:2016-05-18 20:36:46
【问题描述】:
我想在 CodeIgniter 中选择 dateStart 和 dateEnd 之间的空闲房间。
我有 2 张桌子 - 房间和预订。
我目前的型号代码:
$this->db->select('rooms.*');
$this->db->join('reservations', 'rooms.ID = reservations.RoomID', 'left outer');
$this->db->where('rooms.Size >=', $PeopleNumber);
$this->db->where('reservations.DateStart <=', $DateEnd);
$this->db->where('reservations.DateEnd >=', $DateStart);
$this->db->group_by('rooms.Size');
$query = $this->db->get('rooms');
我已经检查过这个问题:MySQL Looking for free rooms in reservation system
但我不知道如何在 CodeIgniter 中进行多选。
我的 SQL 小提琴:http://sqlfiddle.com/#!9/c1f95/8
【问题讨论】:
标签: php mysql codeigniter date