pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Zhidian Du <zdu@cs.nmsu.edu>
To: knut.suebert@web.de
Cc: pgsql-php@postgresql.org <pgsql-php@postgresql.org>
Subject: Re: How can I get metadate of a table in PHP3?
Date: Sun, 01 Sep 2002 16:22:19 -0600
Message-ID: <3D72931B.9040902@cs.nmsu.edu> (raw)
References: <3D71AF16.E4216C05@cs.nmsu.edu>
	<20020902194412.GA657@fraxinus.reticulum>

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.suebert@web.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
>
>
>  
>

view thread (4+ messages)  latest in thread

Message-ID: <3D72931B.9040902@cs.nmsu.edu>
Permalink:  ../3D72931B.9040902@cs.nmsu.edu/
Also on:    postgresql.org/message-id/3D72931B.9040902@cs.nmsu.edu

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-php@postgresql.org
  Cc: zdu@cs.nmsu.edu, knut.suebert@web.de
  Subject: Re: How can I get metadate of a table in PHP3?
  In-Reply-To: <3D72931B.9040902@cs.nmsu.edu>
  References: <3D71AF16.E4216C05@cs.nmsu.edu> <20020902194412.GA657@fraxinus.reticulum> <3D72931B.9040902@cs.nmsu.edu>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox