setFetchMode problem with mssql/w2003/php503

From: Date: Fri, 07 Jan 2005 04:01:20 +0000
Subject: setFetchMode problem with mssql/w2003/php503
Groups: php.db 
Request: Send a blank email to php-db+get-38058@lists.php.net to get a copy of this message
I'm getting this error when attempting to use setFetchMode() PHP Fatal error: Call to undefined method DB_result::setFetchMode() in new.php on line 27 My code looks like this for now, almost the same as some of the samples getting around: $db = DB::connect("mssql://blah:blah@blah/blah"); if (DB::isError($db)) { die ($db->getMessage()); } $res=$db->query("select * from Contacts"); if (DB::isError($res)) { print $res->getMessage() . "\nDetails: " .$res->getUserInfo(); } else { $res->setFetchMode(DB_FETCHMODE_ASSOC); $row=$res->fetchRow(); $field0=$row['ID']; $field1=$row['Name']; $res->free(); $db->disconnect(); } Just incase this could be an installation related problem I should explain that I am using this in a virtual PC environment with IIS6, PEAR was downloaded via a "normal" machine and then copied to the virtual PC and go-pear was run (I think that's it). A function based connection like this: function execute_query($db,$sql) { debug($sql); $db->setFetchMode(DB_FETCHMODE_ASSOC); return $db->getAll($sql); } seems to return data instead of erroring out. I'm just a bit lost as to why the first lot of code has a problem with DB_result. If anyone can help that would be great. Thanks for your time.

« previous php.db (#38058) next »