Re: Weird DB_DataObject problem

From: Date: Thu, 29 Sep 2005 22:08:40 +0000
Subject: Re: Weird DB_DataObject problem
References: 1 2 3  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-21162@lists.php.net to get a copy of this message
On 9/29/05, Joseph Szobody <php-newsgroup@signaturetechstudio.com> wrote: > > "Justin Patrin" <papercrane@gmail.com> wrote in message > news:432beae05092914371489e1d6@mail.gmail.com... > On 9/29/05, Joseph Szobody <php-newsgroup@signaturetechstudio.com> wrote: > > Folks, > > > > I just installed DB_DataObject on my server, and moved over some code that > > I > > had working on another server. I am having a very strange problem where my > > find() returns a number of results, but when I go to fetch there is > > nothing > > there. If I turn on debug and do a get(), I see a serialized array that > > contains data from the database, but when I try to echo a value or even do > > a > > print_r() on the DO I get an empty object. > > > > For instance, here is one quick example: > > > > DB_DataObject::debugLevel(5); > > $dbo = DB_DataObject::factory("tbl_admin"); > > $num = $dbo->find(); // Find everything > > echo "Results found: $num <br>"; > > while($dbo->fetch()) { > > print_r($dbo); > > } > > > > Now, there are three rows in the "tbl_admin" table admin table, and the > > above correctly echoes "Results found: 3". But as soon as I do > > $dbo->fetch, > > I get this: > > > > dbo_tbl_admin: FETCH: No data returned from FIND (eg. N is 0) > > > > If I add any whereAdds() before find, it correctly finds the right > > records, > > and again displays the correct "Results found:". So it connects to the > > database fine, and the query works, but when fetch() goes to fetch it it > > gives me an error that there is no data. > > > > Any help would be greatly appreciated. > > > > > Do you have overloading turned off? > > > > -- > > Justin Patrin > > No, I didn't. I just turned it off and that fixed it. What is overloading? > Where can I read about this option? I didn't see it in the online docs for > DB_DataObject. > It is in the online docs, right at the beginning. It say to turn it off. Basically it lets you use getters and setters even if you don't define them. Don't use it, it breaks things (like here). -- Justin Patrin

« previous php.pear.general (#21162) next »