In the view it is getting the error like undefined variable categorylist,can u
pls help me !!!!!!!
Controller
public function categorylist()
{
$data['categorylist']=$this->userprocessmodel->categorylist();
$this->load->view('user/home',$data);
}
Model
public function categorylist()
{
$query=$this->db->get('category');
echo $query->num_rows();
if($query->num_rows()>0)
{
return $query->result();
}
else
{
return null;
}
}
view
<?php
if($categorylist)
{
foreach($categorylist as $categorylist)
{
$categorylist->categoryname;
}
}
?>
Just change these code in model
Now in controller if 0 get then