Problem with executing two queries simultaneously (nested queries)

From: Date: Wed, 20 Nov 2002 20:56:56 +0000
Subject: Problem with executing two queries simultaneously (nested queries)
Groups: php.db 
Request: Send a blank email to php-db+get-23541@lists.php.net to get a copy of this message
I'm having problems calling a second query while looping through the results from another. It seems the main query is stopping after two records even though there are more records to read. The code looks something like this. I've simplified it because it's actually quite long. The weird thing is that if i remove the call to func I get five records, but with the call to func I only get the first two then it stops. $sth = $db->prepare("SELECT count(*), id from foo group by id"); $r = $db->execute($sth); while($r->fetchinto($row)) { func($row->id); } And func does its own query: function func($id) { $assoc = $db->getassoc("select code, val from bar where id=?", false, array($id)); return assoc($code); } This is with postgres, btw. Incidentally, is there a cleaned up version of PEAR::db? There seem to be a lot of little mistakes in the design that I would have expected a second revision of the API to clean up by now. -- greg

« previous php.db (#23541) next »