I have a site based on the PHP framework, CodeIgniter. I am facing a problem while fetching data from the database table travels_detail
on a page.
The controller method:
function search_travel(){
$departure= $this->input->post('departure');
$destination= $this->input->post('destination');
$data['var']= $this->Travel->search_travel($departure, $destination);
$this->load->view('flight-list',$data);
}
And the model method:
function search_travel($departure, $destination){
$this->db->select()->from('travels_detail')->where('departure', $departure)->where('destination', $destination);
$query= $this->db->get();
return $query->result_array();
}
The problem is, I want to execute another query and want to get some data from another table in the same page.
For instance, I'm getting data from travels_detail
table of airline: arik
and I want to get the image of arik
airline from airlines
table.
The query should be:
select image from airline where airline = '$airline'
How do I do this in CodeIgniter?