<?php 
class HotelBooking_model extends CI_Model {
	
	public function _consruct(){
		parent::_construct();
 	}

 	public function getHotelBookingData($booking_id=''){
 		$var = (!empty($booking_id))?",HTBK.request_data":"";
 		$cond = (!empty($booking_id))?" WHERE HTBK.hotel_book_id='$booking_id' ":"";
 		$query = $this->db->query("SELECT HTBK.id,HTBK.hotel_book_id,HTBK.hotel_name,HTBK.hotel_image,HTBK.checkin,HTBK.checkout,HTBK.price,TRNS.status,CUST.name AS customer_name,CUST.phone AS customer_phone,CUST.email AS customer_email,CUST.gender,TRNS.transaction_id $var FROM hotel_booking AS HTBK INNER JOIN transaction AS TRNS ON HTBK.hotel_book_id = TRNS.booking_id INNER JOIN customer AS CUST ON CUST.customer_id = TRNS.customer_id $cond");
 		if(empty($query) && empty($query->num_rows() <= 0)){
 			return 0;
 		}
 		if(!empty($booking_id)){
 			return $query->row();
 		}
 		return $query->result();
 	}
}
?>