Hy, I am working in codeigniter and I need to get multiple results on the same page. How I can do it.
Look at my code of Model, Controller and view.
Model:
function asia(){
$this->db->distinct();
$this->db->select();
$this->db->from('travels_detail t');
$this->db->join('all_destination a','t.destination = a.destination','inner');
$this->db->where('region', 'asia');
$this->db->group_by('t.destination');
$query= $this->db->get();
return $query->result_array();
}
controller:
function asia(){
$data['asia'] = $this->travel->asia();
$this->load->view('testing', $data);
}
view:
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
</head>
<body>
<table border="1">
<tr>
<td> Departure </td> <td> Destination </td>
<td> Airline </td> <td> Fare </td>
<td> Type </td> <td> Via </td>
</tr>
<?php foreach($asia as $row){ ?>
<?php
echo '<tr>
<td> '.$row['departure'].' </td>
<td> '.$row['destination'].' </td>
<td> '.$row['airline'].' </td>
<td> '.$row['fare'].' </td>
<td> '.$row['type'].' </td>
<td> '.$row['via'].' </td>
</tr>';
}
?>
</table>
</body>
</html>
I get data of a continent "asia" from my database and display in a table. similarly i have to get some other data on the same page. Help me out please