Re: MDB2 simple test
| From: | Michael Henry | Date: | Sun, 12 Nov 2006 01:28:18 +0000 |
| Subject: | Re: MDB2 simple test | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-25778@lists.php.net to get a copy of this message | ||
Alain Roger wrote:
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. I recently started using MDB2 and had all sorts of problems trying to get it to work. It turned out that I hadn't installed MDB2_Driver_pgsql. Unfortunately the error messages gave no indication of the real cause of the problem.