Manage an empty query |
There is more than one way to handle this. In your case it might be most easily done by not returning FALSE from the model. Why? Because $query->result() returns an empty array when no records are found and that fact can be used in the view.
Here's a revised model that potentially will return an empty array. PHP Code: public function biens_location() Your controller is unchanged. On the view your check the var and respond with your message if the var is empty. PHP Code: if(empty$biens)) You could also leave the model as is and revise your controller to conditionally provide an empty array to the view just described. PHP Code: public function location() |
Messages In This Thread |
Manage an empty query - by cybersven - 03-28-2017, 04:03 AM
RE: Manage an empty query - by cybersven - 03-28-2017, 06:18 AM
RE: Manage an empty query - by dave friend - 03-28-2017, 06:43 AM
|