Welcome Guest, Not a member yet? Register   Sign In
How do you pass a model variable to a controller
#1

[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;
  }
  
}

}


Messages In This Thread
How do you pass a model variable to a controller - by El Forum - 08-19-2012, 03:14 PM
How do you pass a model variable to a controller - by El Forum - 08-19-2012, 03:20 PM
How do you pass a model variable to a controller - by El Forum - 08-19-2012, 03:21 PM
How do you pass a model variable to a controller - by El Forum - 08-19-2012, 03:23 PM
How do you pass a model variable to a controller - by El Forum - 08-19-2012, 05:19 PM



Theme © iAndrew 2016 - Forum software by © MyBB