Re: How can I get metadate of a table in PHP3?

From: Zhidian Du <zdu(at)cs(dot)nmsu(dot)edu>
To: knut(dot)suebert(at)web(dot)de
Cc: "pgsql-php(at)postgresql(dot)org" <pgsql-php(at)postgresql(dot)org>
Subject: Re: How can I get metadate of a table in PHP3?
Date: 2002-09-01 22:22:19
Message-ID: 3D72931B.9040902@cs.nmsu.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php

My meaning is how can I get all the fields name of a table?

ID Name Age ....
1 John 20
2 Smith 23
.....

Get ID, Name and Age and so on.

knut(dot)suebert(at)web(dot)de wrote:

>Zhidian Du schrieb:
>
>
>
>>How can I get metadate of a table in PHP3?
>>
>>
>
>If you think about things like the output of "\d tablename", turn on
>the logging of queries, do a "\d tablename" and watch the
>logfiles.
>
>Somewhere I need the fieldtypes of a table named $this->table, the
>query is
>
> $q = "SELECT a.attname, format_type(a.atttypid, a.atttypmod)
> FROM pg_class c, pg_attribute a
> WHERE c.relname = '".$this->table."'
> AND a.attnum > 0 AND a.attrelid = c.oid
> ORDER BY a.attnum";
>
>which is stolen from the logs - I'll never understand it ;)
>
>Greetings,
>Knut Sübert
>
>---------------------------(end of broadcast)---------------------------
>TIP 6: Have you searched our list archives?
>
>http://archives.postgresql.org
>
>
>
>

In response to

Browse pgsql-php by date

  From Date Subject
Next Message arun kv 2002-09-02 04:50:34 How to start PgSQL on FreeBSd to the port 5432
Previous Message Michael Rogers 2002-09-01 15:56:37 Re: Web Hosting