db=$GLOBALS['db']; $this->ask="SELECT * FROM ecmtransactions WHERE deleted='0' AND record_type='EcmInvoiceOuts' AND type='0' AND register_date > '2011-12-31' AND (settled='0' OR settled IS NULL) and payment_date < '".date("Y-m-d")."' ORDER BY payment_date desc"; $this->reply=$this->db->query($this->ask); while($this->result=$this->db->fetchByAssoc($this->reply)){ $this->document_list[]=$this->result; } var_dump($this->document_list); } } $c=new InterestInvoices(); $c->searchInterestInvoices();