Skip site navigation (1) Skip section navigation (2)

Re: [INTERFACES] Using php and postgres

From: gravity <z(dot)nijmeyers(at)cable(dot)a2000(dot)nl>
To: Edouard DESSIOUX <edx(at)intrinsec(dot)com>, pgsql-interfaces(at)postgresql(dot)org
Subject: Re: [INTERFACES] Using php and postgres
Date: 1999-10-15 11:33:13
Message-ID: 4.1.19991015132916.00a76da0@mail.a2000.nl (view raw or flat)
Thread:
Lists: pgsql-interfaces
At 12:08 14-10-99 +0200, Edouard DESSIOUX wrote: 
>
> Hello,
> I'm using apache postgres and php,
> I created a database called "manip"
> and i want to acces this database via a web page
>
> I use the following php script to connect to the base:
> <?php $database = pg_connect ("dbname=manip port=5432"); ?> 


use pg_connect ("dbname=manip user=USERNAME password=PASSWORD port=5432")

>
> And i obtain :
> Warning: Unable to connect to PostgresSQL server: FATAL 1: Database www does
> not exist in pg_database in
> /www/dooz.corp.intrinsec.com/mail/essai.php3 on line 3


if you don't declare user then the connection will be made with the user
running php/apache: in this case 'www'.
the connection fails because the username is not correct and I guess pg then
tries to connect you to your own database, named after the user: 'www'



In response to

pgsql-interfaces by date

Next:From: Jan WieckDate: 1999-10-15 11:54:11
Subject: Re: Scripts (was Re: [HACKERS] Re: [INTERFACES] Next release is 7.0(?))
Previous:From: Michael MeskesDate: 1999-10-15 11:22:39
Subject: Re: [INTERFACES] ecpg - example code

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group