Re: [ADMIN] pgsql + php3 expert needed. Can you solve this problem? - Mailing list pgsql-admin

From Terry Mackintosh
Subject Re: [ADMIN] pgsql + php3 expert needed. Can you solve this problem?
Date
Msg-id Pine.LNX.3.95.981227085138.30930A-100000@terry1.acun.com
Whole thread Raw
In response to pgsql + php3 expert needed. Can you solve this problem?  (Robert Chalmers <robert@chalmers.com.au>)
List pgsql-admin
Hi Robert

On Sun, 27 Dec 1998, Robert Chalmers wrote:

> Since I have updated, either php3, or pgsql, is refusing a connection from the
> php3 engine to the database.
> ....
> <html>
> <body>
> <?php  $database = pg_connect("host=nanguo dbname=ecotourism port=5432");  ?>

I use PHP 3 all the time, and have never seen the above syntax, is that
PHP/FI syntax? so that may be your problem.  Here is how I do it:

if ( !($database = pg_connect("localhost","5432","","","ecotourism")))
{// NOTE the use of 'localhost', if it's all on 1 box, thats all you need.
   echo "Bad connection to database!<p>Sorry<p>.\n";
}
else
{
// Good to go!
}

> <br>
> <?php  if ($database):
>  echo "Database Connection.";
>     else:
>  echo "Database NOT Connected.";
>  endif;
> ?>
> <br>
> </body>
> </html>


Hope that helps
Terry Mackintosh <terry@terrym.com>          http://www.terrym.com
sysadmin/owner  Please! No MIME encoded or HTML mail, unless needed.

Proudly powered by R H Linux 4.2, Apache 1.3, PHP 3, PostgreSQL 6.4
-------------------------------------------------------------------
Success Is A Choice ... book by Rick Patino, get it, read it!


pgsql-admin by date:

Previous
From: Robert Chalmers
Date:
Subject: Re: [PHP3] pgsql + php3 expert needed. Can you solve this problem?
Next
From: Terry Mackintosh
Date:
Subject: Re: [ADMIN] pgsql + php3 expert needed. Can you solve this problem? (fwd)