pear db and pgsql

From: Date: Wed, 02 May 2001 19:29:38 +0000
Subject: pear db and pgsql
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-9066@lists.php.net to get a copy of this message
i'm having a hell of a time figuring out how to connect to a postgresql database using the pear db abstraction...here's some code snippets: with mysql (works fine): require_once('DB.php'); $db = DB::connect("mysql://username:password@localhost/audio"); if (DB::isError($db)) { print $db->getMessage(); } $select_query = "SELECT * FROM items"; $result = $db->query($select_query); while ($row = $result->fetchRow()) { print "$row[1]<BR>"; } $db->disconnect(); with pgsql (dies with this error: DB Error: unknown error Fatal error: Call to undefined function: query() in /path/pg_test.php on line 8) require_once('DB.php'); $db = DB::connect("pgsql://username:password@localhost/audio"); if (DB::isError($db)) { print $db->getMessage(); } $select_query = "SELECT * FROM items"; $result = $db->query($select_query); while ($row = $result->fetchRow()) { print "$row[1]<BR>"; } $db->disconnect(); both databases exist, along with the tables....$10 says i'm being dumb, and need to put the port # someplace on the postgres connect, but i can't seem to put it in the right place..... tia, r

« previous php.db (#9066) next »