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


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to