Connecting Tech Pros Worldwide Forums | Help | Site Map

Displaying column data types in a table?

bissatch@yahoo.co.uk
Guest
 
Posts: n/a
#1: Aug 23 '05
If I want to determine what data types a table has, how would I do this
using PHP?

I tried looking into SHOW TABLES but would I be correct in saying that
just displays a list of tables? I want some way of analizing a single
table and outputing the column data types. Btw, I am using a PostgreSQL
database.

Cheers

Burnsy


ZeldorBlat
Guest
 
Posts: n/a
#2: Aug 23 '05

re: Displaying column data types in a table?


Don't know a whole lot about PostgreSQL, but you could probably execute
a query like:

select * from some_table

Then use pg_field_type() on the result:

http://www.php.net/manual/en/function.pg-field-type.php

Andy Hassall
Guest
 
Posts: n/a
#3: Aug 23 '05

re: Displaying column data types in a table?


On 22 Aug 2005 16:17:11 -0700, bissatch@yahoo.co.uk wrote:
[color=blue]
>If I want to determine what data types a table has, how would I do this
>using PHP?
>
>I tried looking into SHOW TABLES but would I be correct in saying that
>just displays a list of tables? I want some way of analizing a single
>table and outputing the column data types. Btw, I am using a PostgreSQL
>database.[/color]

http://www.postgresql.org/docs/8.0/i...on-schema.html
http://groups.google.co.uk/groups/di...stgresql&hl=en

--
Andy Hassall :: andy@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Closed Thread