Hi all,
     I've finally set up a postgres db with a table and a few entries in (I
think), now I'm trying to
connect this to a web page. I've put the pgsql module in the php.ini file
and created a page with the following code;

<html>
<head>
<title>PHP Test</title>
</head>
<body>
<?php
$conn=pg_connect("", "", "", "", "docreg");
if( !$conn ) {
        echo "An error occured.\n";
        exit;
}
$sql="SELECT * FROM docreg;";
$result_set=pg_Exec( $conn, $sql );
$rows=pg_NumRows( $result_set );
if( ( !$result_set ) || ( $rows < 1 ) ) {
        echo "<H1>ERROR - no rows returned</H1><p>";
        exit;
}
for( $j=0; $j<$rows; $j++ ) {
        echo pg_result( $result_set, $j, "column_name" );
}
?>
</body>
</html>

So, as far as I can tell this _should_ work. Trouble is I get the following
message;

Warning: Unable to connect to PostgresSQL server: FATAL 1: SetUserId: user
"www-data" is not in "pg_shadow" in /usr/local/www/hello.php3 on line 7
An error occured.

I can't add www-data to the pg_shadow file using createuser because of the
'-' character, so the question is
How do I get this to work?
I don't want to have a specific user connect to the db at this point in
time although I will in the future so I could
use any ideas that you have to offer.

I'd appreciate a cc as well because I'm at work at the moment and I'm not
going to be able to pick up this list until I go home.

Thanks

Reply via email to