[eluser]megabyte[/eluser]
I have a form, and the same view does adds and edits so I'm using this format for my code in the form
Code:
$course_name = array('name' => 'course_name',
'id' => 'course_name',
'class' => 'text long',
'value' => set_value('course_name', $row->course_name));
echo form_input($course_name);
//And in the controller
function add()
{
$data['row'] = array();
$this->load->view($this->view.'edit', $data);
}
function edit()
{
$query = $this->db->get_where($this->tbl, array($this->primary_key => $this->id));
$data['row'] = $query->row();
$this->load->view($this->view.'edit', $data);
}
notice the empty
Code:
$data['row'] = array();
in the add method. I thought this would suppress any erros but im getting
Code:
A PHP Error was encountered
Severity: Notice
Message: Trying to get property of non-object
Someone tell me what im doing wrong?