Check the documentation on pg_query. http://www.php.net/manual/en/function.pg-query.php It expects the link identifier as the first argument and the query as the second. Switch your arguments and you might have some luck. The manual is always a great place to look for answers to things like this. -----Original Message----- From: Nathaniel Price [mailto:seoman@myrealbox.com] Sent: Friday, March 28, 2003 11:05 AM To: php-db@lists.php.net Subject: Connection issues with pgsql? Hi, I just installed PHP with pgsql support, and it doesn't seem to work properly, although I don't see why it shouldn't. I'm running the following script: <?php error_reporting (E_ALL); $myconn = pg_connect("dbname=thornvalley"); $res = pg_query('select * from test;', $myconn); print_r(pg_fetch_row($res)); ?> and this is what I get back: Warning: pg_query(): supplied argument is not a valid PostgreSQL link resource in /var/www/html/dbtest.php on line 4 Warning: pg_fetch_row(): supplied argument is not a valid PostgreSQL result resource in /var/www/html/dbtest.php on line 5 without any other clues as to what might be happening. I have tried using other connection strings as well: "dbname=thornvalley user=apache password=[passwd]" "dbname=thornvalley user=apache password=[passwd] host=localhost port=5432" with the same result. I'm not sure what's going on; just so that you know, I'm using the RPM-based install of Apache 2.0.44, PHP 4.3.1 and PostgreSQL 7.3.2 that comes with Mandrake Linux 9.1. All of the necessary support packages (AFAIK) have been installed and are visible with phpinfo() (i.e. there's a pgsql section), and I have defined an apache user in the PostgreSQL database... so, any clues as to what might be going on? ________________________________________ Nathaniel Price http://www.thornvalley.com "Who is General Failure and why is he reading my hard drive?" -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php