RE: [PEAR] DB Fetch

From: Date: Thu, 20 Jun 2002 12:23:21 +0000
Subject: RE: [PEAR] DB Fetch
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-1719@lists.php.net to get a copy of this message
That's because when you set your fetchmode to: DB_FETCHMODE_ASSOC your telling pear db only to load associative results. I believe with PEAR DB you can only do one or the other: Look at this page http://vulcanonet.com/soft/?pack=pear_tut I didn't look at the docs so the info your looking for might be in there. -----Original Message----- From: Birgir Stefansson [mailto:bs@hi.is] Sent: Thursday, June 20, 2002 8:06 AM To: pear-general@lists.php.net Subject: [PEAR] DB Fetch Hi. I've been porting my project from using direct pg functions to using PEAR::DB and I was wondering why I couldn't do the following: $db->setFetchMode(DB_FETCHMODE_ASSOC); $result = $db->query("select field1, field2 from table") while($element = $result->fetchRow()) { echo $element['field1']; echo $element[0]; } Howcome I can't reference with both 'field1' and 0 ? BS

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