setFetchMode problem with mssql/w2003/php503

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

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



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux