Re: MDB transactions in pgsql driver

From: Date: Wed, 28 May 2003 11:47:17 +0000
Subject: Re: MDB transactions in pgsql driver
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-16773@lists.php.net to get a copy of this message
Lukas Smith wrote:
Hi,
I don't know, it was working before. It's simple stuff I'm trying to do. I've simplyfied the code to make it easier to debug. <?php include 'MDB.php'; $db = &MDB::connect(DSN); //$db->captureDebugOutput(TRUE); $db->setFetchMode(MDB_FETCHMODE_ASSOC); $groups = $db->getAssoc('SELECT group_id, name FROM groups'); foreach ($groups as $group_id => $groupname) { $query = 'SELECT perm FROM permissions WHERE section_id='.$db->getIntegerValue($section_id).' AND group_id='.$db->getIntegerValue($group_id); $perms = $db->queryOne($query); $defaults["perm[$group_id]"] = empty($perms) ? 'NONE' :
trim($perms);
$radio = array(); unset($radio); } ?>
I'll dive into the code, see if it's easy to fix.
So the errors you were receiving happend in this code fragment? Yes. in:
$groups = $db->getAssoc('SELECT group_id, name FROM groups'); To be exact. I was debugging and saw some weird results. The method FetchInto is being called twice, once with a valid PG result resource, but the second time it calls the method where $result is a string 'Coordinators' which is in teh first row inside the groups table in the DB. I don't have time to further investigate right now, but this should give you some leads. HTH Jeroen

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