Hey everyone, got a problem here.  I'm using php4.2.1, postgres 7.2.  I'm
trying to do a simple database connect with the following small php script:
<html><head><title>PHP Test</title></head>

//connect to postgres database
$conn=pg_connect("user=bnoecker dbname=brian");

//see if our connection was successful
if ($conn==false) {
    //connection failed - exit the page with an error
    echo pg_errormessage($conn);
else if($conn) {
        echo "I did it";
$sql="SELECT * FROM employee";
$sql_result=pg_exec($conn.$sql) or die ("Couldn't Execute Query.");

I can manually run the SELECT * FROM employee string and get results with
user bnoecker.  I've granted all to bnoecker and as well added the postgres
admin to the user=.  In test, no password has been assigned.  I do not get a
connection failed message, in fact I do the the "I did it" message.  I do
however get the following as it tries to do the query:

I did it
Warning: pg_exec() query failed: ERROR: parser: parse error at or near
"resource" in /home/bnoecker/public_html/hello.php on line 19
Couldn't Execute Query.
Now, others use the same postgres instance with other databases from php
scripts without issue, mostly using includes.  Can someone show me what I
may be overlooking.  I'm new to php but I found examples where things are
basically layed out like what I've got?


PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to