The following function is supposed to read the name
of the given asset code from the database, but it triggers the error: "Trying to get property of non-object"
public function sban_name($asset)
{
$this->db->select('name');
$this->db->from('asset_types');
$this->db->where('code',$asset);
return $this->db->get()->result()->row('name');
}
All I want is to have the asset name
value returned back to the controller.
Use row()
like,
return $this->db->get()->row()->name;