我想以員工的名義鏈接.....當我點擊任何名字,然後顯示他的詳細信息....我創建此代碼..bt一些錯誤「試圖獲得非對象」 ....請幫助我的財產......如何通過鏈接從數據庫獲得ID
1.controller
function abc($id = 0)
{
$this->load->model('emp_model');
$data['rows'] = $this->emp_model->get();
$this->load->view('personal_emp',$data);
}
2.models
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>
echo「」。 ('employee/abc /',$ r-> name)。「」; ....這是我的鏈接..... – jitu
所以你不認爲你得到的是一個錯誤信息我們需要? –
我得到錯誤未定義的變量:行 – jitu