[eluser]Unknown[/eluser]
I have two tables (client and employee) in my database, one column of the employee table (location) get its data from the client table (company_name column), if i tried to make a report, instead of showing the real data from the client table, it shows only number (1,2,3 etc). I am a beginner both in Php and codeigniter, please help me. here are my code.
this is my controller.
function passport_exp() {
$data['title'] = 'Passport Expiry';
$data['detail'] = $this->buku_model->passport_exp();
$this->load->view('passport_exp', $data);
}
this is my model.
function passport_exp() {
$this->db->select('*');
$this->db->from('employee');
$this->db->order_by('passport_expiry','ASC');
$getData = $this->db->get();
if($getData->num_rows() > 0)
return $getData->result_array();
else
return null;
}
and this is my view.
<?php if(count($detail) > 0) { ?>
<table border="1">
<tr>
<th>---Passport Expiry---</th>
<th>---Badge---</th>
<th>---First Name---</th>
<th>---MI---</th>
<th>---Last Name---</th>
<th>---Position---</th>
<th>---Location---</th>
<th>---Nationality---</th>
<th>---Mobile Number---</th>
</tr>
<?php
foreach($detail as $rows) {
echo "<tr>";
echo "
<td>". $rows['passport_expiry'] ."</td>
<td>". $rows['badge'] ."</td>
<td>". $rows['first_name'] ."</td>
<td>". $rows['middle_name'] ."</td>
<td>". $rows['last_name'] ."</td>
<td>". $rows['position'] ."</td>
<td>". $rows['location'] ."</td>
<td>". $rows['nationality'] ."</td>
<td>". $rows['mobile_number'] ."</td>
"; } ?>
</table>
<?php } ?>