Connecting to database using pg_connect

From: <Gene(dot)Brumm(at)thomson(dot)com>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: Connecting to database using pg_connect
Date: 2005-03-29 18:49:14
Message-ID: D7E3DC215167A3479A7B771C33BC0EBE06ED666B@tlrusmneagmbx01.erf.thomson.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

I am having trouble connecting to a PostgreSQL database using the
following code. The first echo message appears but none of the others. I
can connect fine using psql. What am I doing wrong?

<html>
<head>
<title>PHP Test</title>
</head>
<body>
<?php
echo 'Before pg_connect ...';
$hDB = @pg_connect("dbname=TestDB user=geneb password=dynamo!");
echo 'Before if ...';
if(! is_resource($hDB)) {
throw new Exception('Unable to connect to the database.');
}
echo 'Got here ...';
?>
</body>
</html>

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Kumar S 2005-03-29 18:49:34 Drawing schema
Previous Message Andreas Kretschmer 2005-03-29 18:46:36 Re: [despammed] Calling Stored Procedures from PHP