NYCPHP Meetup

NYPHP.org

[nycphp-talk] PEAR DB prepared statements. PHP 5 / DB2 8

Flavio daCosta nyphp at n0p.net
Wed Apr 20 14:41:23 EDT 2005


On Wed, 2005-04-20 at 14:34 -0400, Daniel Krook wrote:
> Whereas this snippet which uses a prepared statement gives me "DB Error: 
> unknown error":
> 
>         $sql = 'SELECT CB.BREED_ID, B.BREED 
>                 FROM CAT_BREED CB, BREEDS B 
>                 WHERE CB.CAT_ID = ? AND CB.BREED_ID = B.BREED_ID';
>  
>         $res =& $db->query($sql, $catId);
> 
>         while ($row =& $res->fetchRow()) {
>            // Populate a Cat object and set its breeds property to the 
> array.
>         } 


$sth =& $db->prepare( $sql );
$res =& $db->execute($sth, $catId);






More information about the talk mailing list