Welcome Guest, Not a member yet? Register   Sign In
return values
#3

(05-29-2016, 08:33 AM)This is perfect. Thank you so much for the examples!---- PaulD Wrote: Normally I would have in my model something like

PHP Code:
public function get_something() 
{
     $results FALSE;
     ...
     $query $this->db->get();
     if ($query->num_rows() > 0)
     {
          $results $query->result_array();
     }
     return $results;


And in the controller you can just test if the return value is FALSE or not.

PHP Code:
     $data $this->some_model->get_something();
     if ($data)
     {
          ... deal with data
     
}
     else
     
{
          ... deal with no data
     


Or you can send the data to the view and deal with the FALSE condition in the view.

Hope that helps,

Paul
Reply


Messages In This Thread
return values - by tanker456 - 05-29-2016, 05:00 AM
RE: return values - by PaulD - 05-29-2016, 08:33 AM
RE: return values - by tanker456 - 05-29-2016, 08:50 AM



Theme © iAndrew 2016 - Forum software by © MyBB