我想链接员工的名字.....当我点击任何名字然后显示他的详细信息......我创建这个代码..bt一些错误“试图获取非对象的属性” ......请帮助我......
1.控制器
function abc($id = 0)
{
$this->load->model('emp_model');
$data['rows'] = $this->emp_model->get();
$this->load->view('personal_emp',$data);
}
2.型号
function get($id)
{
$this->load->database();
return $this->db->get_where('employee',array('id'=>$id))->row_array();
}
3.views
<table border="1" height="200" width="200" bordercolor="#003366" align="center">
<tr>
<th>ID</th></td>
<th>NAME</th>
<th>Fathet Name</th>
<th>Dob</th>
<th>Qualification</th>
<th>Identity Type</th><th>Identity No</th>
<th>Gender</th>
<th>Email</th>
<th colspan='2'>Action</th>
</tr>
<?php foreach($rows as $r)
{
echo "<tr>";
echo "<td>". $r->id ."</td>";
echo "<td>". $r->name ."</td>";
echo "<td>". $r->father_name ."</td>";
echo "<td>". $r->dob ."</td>";
echo "<td>". $r->qualification ."</td>";
echo "<td>". $r->identity_type ."</td>";
echo "<td>". $r->identity_no ."</td>";
echo "<td>". $r->gender ."</td>";
echo "<td>". $r->email ."</td>";
echo "<td>". anchor('employee/input/'.$r->id,'Edit') ."</td>";
echo "<td>". anchor('employee/del/'.$r->id,'Delete') ."</td>";
echo "</tr>";
echo "<br>";
}
?>
</table>