Welcome Guest, Not a member yet? Register   Sign In
Manage an empty query
#1

Hi,

I got a model :

PHP Code:
           public function biens_location()
 
           {
 
                       $query $this->db->select('')
 
                       ->from('biens')
 
                       ->where('actif''1')
 
                       ->where('rent','1')
 
                       ->get();
 
                       if($query->num_rows()!==0)
 
                       {
 
                                   return $query->result();
 
                       }
 
                       else
                        
{
 
                                   return FALSE;
 
                       }
 
           
and a controller :
PHP Code:
           public function location()
 
           {
 
                       $this->data['biens'] = $this->Biens_model->biens_location();
 
                       $this->data['title'] = "Location";
 
                       $this->render('location_view');
 
           
and my view :
PHP Code:
foreach ($biens as $bien)
{
...


Everything is Ok, but in the case there is no result I got an error so I would like to check results and show a message on the page something like "There are no properties for rent".
How can I achieve this ?
Reply


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



Theme © iAndrew 2016 - Forum software by © MyBB