Re: PHP-Postgres link

From: Charles Tassell <ctassell(at)isn(dot)net>
To: "Ramses v(dot) Pinxteren" <ram6(at)euronet(dot)nl>, pgsql-general(at)postgresql(dot)org
Subject: Re: PHP-Postgres link
Date: 2000-04-10 03:28:51
Message-ID: 4.2.0.58.20000410002638.00a52460@mailer.isn.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Try replacing $connection = pg_connect("", "", "", "users"); with
$connection = pg_connect("dbname=users") or you might want to try
$connection = pg_connect("dbname=users user=nobody")

At 11:53 AM 4/9/00, Ramses v. Pinxteren wrote:
>Hi,
>
>I am running PHP under APache with a link to a postgres database. It gives
>me a headache because it is not working.
>
>I am running Apache as nobody, and I have made a Postgres user also named
>nobody.
>
>I made a postgres database users (as nobody: createdb users) and with psql a
>database login (field 1: userindex, field 2 username, field 3 password,
>field 4 security level)
>
>with psql i can do everything I want with this table. adding tuples,
>deleting them etc. etc.
>
>Now what do i need: I need a script that adds a new user to this database.
>so I created this:
><?
> $connection = pg_connect("", "", "", "users");
> echo ("$connection");
> $query = "INSERT INTO users.login VALUES ( '$userindex', '$uname',
>'$passwrd1', '1')";
> echo ("$query");
> $result = pg_exec ($connection, "select *");
> print (pg_cmdtuples($result));
> pg_close($connection);
>?>
>
>This generates an error at the HTML output:
>
>1INSERT INTO login VALUES ( '1', 'test', 'test', '1');
>Warning: PostgresSQL query failed: ERROR: login: Table does not exist. in
>/usr/local/apache/htdocs/isis.cx/database_update.php3 on line 6
>
>Warning: 0 is not a PostgresSQL result index in
>/usr/local/apache/htdocs/isis.cx/database_update.php3 on line 7
>
>
>in the logffiles is specifies:
>FindExec: found "/usr/local/postgres/bin/postgres" using argv[0]
>started: host=localhost user=nobody database=users
>InitPostgres
>StartTransactionCommand
>ERROR: login: Table does not exist.
>AbortCurrentTransaction
>proc_exit(0) [#0]
>shmem_exit(0) [#0]
>exit(0)
>/usr/local/postgres/bin/postmaster: reaping dead processes...
>/usr/local/postgres/bin/postmaster: CleanupProc: pid 19113 exited with
>status 0
>
>
>I am a complete newby, so please go easy on me!
>
>Tnx!
>Ramses
>
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Charles Tassell 2000-04-10 03:34:52 Re: Permission denied while importing data from a file?
Previous Message Charles Tassell 2000-04-10 03:25:11 Re: Selecting field names?