Trying to get property ‘id_petugas’ of non-object
تبليغيرجى شرح بإيجاز لمإذا تشعر أنك ينبغي الإبلاغ عن هذا السؤال.
I want to update table in Codeigniter 3 , but i got this error. i can not get data from database and move it to form. please help me guys
here is my code (Controller)
public function editPetugas($id)
{
$where = array(‘id_petugas’ => $id);
$data[‘petugas’] = $this->TampilPetugas->ubahData($where, ‘tbl_petugas’)->result_array();
$this->load->view(‘updatedatapetugas’, $data);
}
Model
public function ubahData($where, $table)
{
return $this->db->get_where($table, $where);
}
view
<div id=”collapse2″ class=”body collapse in”>
<?php foreach ($petugas as $pt) { ?>
<form class=”form-horizontal” action=”<?php echo base_url() . ‘Admin/editPetugas’ ?>” method=”post” id=”popup-validation”>
<div class=”form-group”>
<label class=”control-label col-lg-4″>ID Petugas</label>
<div class=”col-lg-4″>
<input type=”text” name=”id_petugas” id=”id_petugas” class=”form-control chzn-select” tabindex=”2″ readonly=”” value=”<?php echo $pt->id_petugas; ?>” />
</div>
</div>
please help me to solve it, i can’t get data form database and move it to form.
أضف إجابة