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

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to