Welcome Guest, Not a member yet? Register   Sign In
Please help me.
#1

[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>
&lt;?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>
"; } ?&gt;
</table>
&lt;?php } ?&gt;
#2

[eluser]Clooner[/eluser]
What is not working? Also, it will be a good idea to wrap the code in the 'code' tags for easy reading.
#3

[eluser]Professor Doidão[/eluser]
I don't understand that you wanna make

what you wanna make?
#4

[eluser]Unknown[/eluser]
the data that shows on the form is something like this,
Name Location Mobile #
Ricardo Zepeat 1 123546987
Richard Allen 21 123659565

I have a separate table for the location column but instead of getting the real data e.g. Philppines, USA. it only shows the ID no.
#5

[eluser]Clooner[/eluser]
So you want to show data stored in two separate tables? You will probably have to use a join or a sub select... This is more a sql issue, I believe. Have you managed to get the data shown as you want in a sql manager? Post the query here and we can help translate it to AR/Query Builder




Theme © iAndrew 2016 - Forum software by © MyBB