Welcome Guest, Not a member yet? Register   Sign In
Best Practices for No Results from Database Query?
#4

[eluser]theprodigy[/eluser]
you can check in your model, and return false if there are no results

Code:
$result = $this->db->get('table');
                          
return ($result->num_rows() > 0) ? $result : false;
Then in your controller
Code:
// ...code...
                
$entries = $this->model->function();
              
if($entries)
{
   // ...load your view...
}
                  
// ...code...


Messages In This Thread
Best Practices for No Results from Database Query? - by El Forum - 02-08-2010, 04:02 PM
Best Practices for No Results from Database Query? - by El Forum - 02-08-2010, 05:32 PM
Best Practices for No Results from Database Query? - by El Forum - 02-08-2010, 05:52 PM
Best Practices for No Results from Database Query? - by El Forum - 02-08-2010, 06:08 PM
Best Practices for No Results from Database Query? - by El Forum - 02-08-2010, 06:16 PM
Best Practices for No Results from Database Query? - by El Forum - 02-08-2010, 06:29 PM



Theme © iAndrew 2016 - Forum software by © MyBB