Re: comments/discussion on pear::DB

From: Date: Tue, 04 Sep 2001 16:00:38 +0000
Subject: Re: comments/discussion on pear::DB
References: 1 2 3  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-1779@lists.php.net to get a copy of this message
On Tuesday 04 September 2001 20:36, Marc Logemann wrote: > cox@idecnet.com (Tomas V.V.Cox) wrote in <01090417163002.11892 > > I come to the point where i need the following function: > > fetchrow($fetchmode, $rownum)) > > the problem i have is, why to declare $fetchmode in the > fetchrow method? > There is a special method for setting the fetchmode. Normally > this wont change in the whole application, so somewhere in your > code you define the fetchmode via: > > $db->setFetchmode(DB_FETCHMODE_ASSOC); > > Right now each time i will use the $rownum parm in fetchRow() i must > redefine $fetchmode? Is this right or do i have some > errors in my argumentation? > The idea is: set a hole fetchmode or set a fetchmode individually. I know that it's a problem when you set a global fetchmode and then want to use the fetch rows by number feature. This should work for you: $db->setFetchmode(DB_FETCHMODE_ASSOC); while($res->fetchInto(DB_FETCHMODE_DEFAULT, $rownum)) { .. } DB_FETCHMODE_DEFAULT is a special constant that reflects the last selected fetchmode. Tomas V.V.Cox

« previous php.pear.dev (#1779) next »