Re: Querying the system catalog - Mailing list pgsql-novice

From Andre Dubuc
Subject Re: Querying the system catalog
Date
Msg-id 200401271823.38298.aajdubuc@webhart.net
Whole thread Raw
In response to Querying the system catalog  ("Marcel Wolf" <mwolfs@comcast.net>)
List pgsql-novice
Hi Marcel,

I believe your error is a result of lack of braces around
$database['datname']. Try:

print (" the 1st database is {$database['datname']}.<br>");

Hth,
Andre

On Tuesday 27 January 2004 05:07 pm, you wrote:
> Hello group
> I am trying to follow through on advice I received from you earlier. I
> would like to check for my database when I logon and if it is not there
> create it( I am using php to write web apps). I am able to connect to
> the template1 and query for pg_database. But I am getting a parse error
> on the following (XXX).
>
> Error message:
> "Expected T_STRING or T_VARIABLE"
>
>
>
> Code :
> $link=pg_connect('user=marcel dbname=template1') or die ("Couldn't
> connect to template1 try again.<br>");
>
>             $query = "SELECT * FROM pg_database";
>
>             $result = pg_query ($query) or die ("Couldn't get the
> database names".pg_last_error());
>
>             // If it worked get the database names.
>
>             $database= pg_fetch_array ($result) or print ("Can't get the
> array of databases<br>");
>
> XXX       print (" the 1st database is $database['datname'].<br>");
>
>             die ("Finshed my test.<br>");
>
> Is this the correct way to query the system catalog for the existing
> databases? Is this questions addressed to the wrong group and maybe
> should be addressed to the php_pgsql group?
> Again thanks for the help
> Marcel Wolf


pgsql-novice by date:

Previous
From: Bruno LEVEQUE
Date:
Subject: Re: Querying the system catalog
Next
From: "Alan T. Miller"
Date:
Subject: SELECT INTO but append not create new table - How?