[eluser]Kraig[/eluser]
Below is my model. How can I get the $num_rows variable if I'm in a controller? I know I could get a function like this
Code:
$this->Upload_model->category();
but how would I access $num_rows if I wanted to create a public variable?
Code:
class Upload_model extends CI_Model {
public $num_rows;
public function category()
{
$query = $this->db->query('SELECT * FROM category ORDER BY name');
$num_rows = $query->num_rows();
$val = $query->result_array();
if($num_rows > 0)
{
return $val;
}
else
{
return;
}
}
}