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

 	public function getFlightBookingData($booking_id=''){
 		$var = (!empty($booking_id))?",FBK.request_data":"";
 		$cond = (!empty($booking_id))?" WHERE FBK.flight_book_id='$booking_id' ":"";
 		$query = $this->db->query("SELECT FBK.id,FBK.flight_book_id,FBK.flight_name,FBK.flight_image,FBK.departure_date,FBK.arrival_date,FBK.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 flight_booking AS FBK INNER JOIN transaction AS TRNS ON FBK.flight_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();
 	}
}
?>