function empAll()
{
$this->db->where('id',$id);
$q = $this->db->get('employee');
if($q->num_rows()>0)
{
foreach($q->result() as $rows)
{
$data[]=$rows;
}
return $data;
}
1 に答える
1
通常、URLでidを渡します。
Base_url()/ index.php / empAll/25。これで、codeigniterはメソッドで$ id=25を自動的に渡します。IDが受信されない場合は、IDに0が割り当てられ、このエラーは発生しません。
function empAll()
{
$q = $this->db->where('id',$this->input->post('id'))
->get('employee');
if($q->num_rows()>0)
{
foreach($q->result() as $rows)
{
$data[]=$rows;
}
}
return $data;
}
于 2012-06-04T11:21:16.633 に答える