Codeigniter-foreach在最后一步不起作用

时间:2019-03-19 17:17:38

标签: codeigniter

我正在开发代码点火器,模型中有5次foreach循环。从1到4所有foreach都可以正常工作..但是5th不能工作。即使它没有任何值,任何数组。

public function admin_lists_of_room($email){              
 $this->db->where('email',$email);      
 $query = $this->db->get('manager');    
 $rows=$query->num_rows();              
 $query=$query->result_array();                          
 foreach($query as $result){      $manager=$result['manager_id'];                  $this->db->where('manager_id',$manager);        $query = $this->db->get('hotel');           $rows=$query->num_rows();                     $query_new=$query->result_array();                               }      
 foreach($query_new as $results){            $hotel=$results['hotel_id'];                                              $this->db->where('hotel_id',$hotel);                    $query = $this->db->get('hotel');                                           $query_new=$query->result_array();                             }     


 foreach($query_new as $results){       
 $room=$results['hotel_id'];           
 $this->db->where('hotel_id',$room);    
 $query = $this->db->get('room');           
 $query_room=$query->result_array();    

 }  
  foreach($query_room as $booking_room_check){
                       $room_id_for_booking_room = $booking_room_check['room_id'];

                        $this->db->where('room_id',$room_id_for_booking_room);
                       $query_booking = $this->db->get('booking_room');

                       $query_room_booking= $query_booking->result_array(); 

  }
 echo "yes"; 
 foreach($query_room_booking as $check_booking){
                      echo "yes";
                     print_r($check_booking);
                      $booking_id = $check_bookingsss['booking_id'];

                      $this->db->where('booking_id',$booking_id);

                       $booking = $this->db->get('booking');

                       $booking_result = $booking->result_array();  
                      print_r($booking_result);

                       }
}

0 个答案:

没有答案