PEAR and MDB2

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

 



Hi,

As i'm new to PEAR world, i try to understand how does it work.
for that i took the MDB2 and try to use it with PostgreSQL.

here is a basic sample extract from PEAR help file and only modified.

require_once 'Pear/MDB2.php';
$dsn = 'pgsql://login:pwd@dbname';

$mdb2 =& MDB2::connect($dsn);
if (PEAR::isError($mdb2))
{
die($mdb2->getMessage());
}

$res =& $mdb2->query('SELECT * FROM articles');
while ($row = $res->fetchRow(MDB2_FETCHMODE_ASSOC))
{
echo $row['title'] . ', ' . $row['content'] . "\n";
}
$res->free();

when i try this code, the following error is raised :
Call to undefined method MDB2_Error::fetchRow() which points to ==> while
($row = $res->fetchRow(MDB2_FETCHMODE_ASSOC))

So i'm lost now ?
i have the feeling that something is missing but what ?

thanks a lot,

Al.

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux