Обсуждение: Connect to database using pg_connect

Поиск
Список
Период
Сортировка

Connect to database using pg_connect

От
Дата:

I'm trying to connect to a database using the following. When I execute this code, I see the "Before pg_connect ..." but nothing else. 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>