Call to a member function result () on a non-object

0

I have the following error: Call to a member function result() on a non-object the error only appears in the 2 "if" if they analyze it in the second "if" there are only 2 extra lines, if I remove those extra lines it is the same as the first "if" and that first if if it is executed correctly. The code is as follows:

if($empresa==0 and $finicial<>'')
       {
               $this->db->select('*');    
               $this->db->from('prospecto_prestamo p');
               $this->db->join('prospecto_referencia R', 'P.numero=R.prospecto', 'inner');
               $this->db->join('prospecto_beneficiario B', 'P.numero=B.prospecto', 'inner');
               $this->db->join('prospecto_seguimiento S', 'P.numero=S.prospecto', 'inner');
               $this->db->where("P.fecha BETWEEN $finicial AND $ffinal");

       }       


       if($empresa>0 and $ahorrador>0 and $finicial<>'' and  $ffinal<>'' )
       {
               $this->db->select('*');    
               $this->db->from('prospecto_prestamo p');
               $this->db->join('prospecto_referencia R', 'P.numero=R.prospecto', 'inner');
               $this->db->join('prospecto_beneficiario B', 'P.numero=B.prospecto', 'inner');
               $this->db->join('prospecto_seguimiento S', 'P.numero=S.prospecto', 'inner');
               $this->db->where("P.fecha BETWEEN $finicial AND $ffinal");
               $this->db->where("P.empresa", $empresa,false);
               $this->db->where("P.ahorrador", $ahorrador,false);       
       }

       $query  = $this->db->get();

       if ($query->num_rows() > 0) return $query->result();
       else  return false;

Thank you very much from now !!!

    
asked by Adrian Juarez 28.09.2018 в 19:27
source

0 answers