我正在使用分页搜索结果.搜索工作完美.搜索后显示前10条记录.但是当我点击下一个按钮时,一切都会消失,并显示一个空白页面.
任何想法在我的代码可能是错的将不胜感激.
模型
function search_bookings($time, $title, $payment, $start_date, $end_date,$limit, $start, $type) {
$this->db->select('reservations.*');
$this->db->from('reservations');
$this->db->where('is_deleted', '0');
$this->db->order_by('date_cal',"desc");
if (!empty($time) && !is_null($time)) {
$this->db->where('reservations.type', $time);
}
if (!empty($payment) && !is_null($payment)) {
$this->db->where('reservations.advanced_payment_status', $payment);
}
if (!empty($title) && !is_null($title)) {
$this->db->where('reservations.title', $title);
}
if (!empty($start_date) && !is_null($start_date)) {
$this->db->where('reservations.date_cal >=', $start_date);
$this->db->where('reservations.date_cal <=', $end_date);
}
if ($type == 'half') {
$this->db->limit($limit, $start);
}
$query = $this->db->get();
return $query->result();
}
Run Code Online (Sandbox Code Playgroud)
调节器
function search_reservations($start = 0) {
$reservation_service = new Reservation_service();
$config = array(); …Run Code Online (Sandbox Code Playgroud) 我在foreach循环中有以下条件语句.我希望检查所有条件语句.我希望通过使用switch case语句可以完成它.任何人都可以给我一个想法如何做到这一点?或者还有其他方法吗?有些日期有关于所有四个条件的值.他们不会检查我是否使用此代码.由于我是新手,我很难弄清楚如何做到这一点.如果有人能提出想法,那将是一个很大的帮助.
foreach ($query->result() as $row) {
if ($row->title == 'GK' && $row->type == 'AM') {
$cal_data[substr($row->date_cal, 8, 2)] = '<div class="gk_am">' . $row->title . ' ' . $row->type . '</div>';
} if ($row->title == 'GK' && $row->type == 'PM') {
$cal_data2[substr($row->date_cal, 8, 2)] = '<div class="gk_pm">' . $row->title . ' ' . $row->type . '</div>';
} if ($row->title == 'RP' && $row->type == 'AM') {
$cal_data3[substr($row->date_cal, 8, 2)] = '<div class="rp_am">' . $row->title . ' ' . $row->type . …Run Code Online (Sandbox Code Playgroud)