For MySQL you can also use the SQL command DESCRIBE TABLE_NAME and loop
through the answer set just as you would any other DB call.

For DB2 the tables would SYSIBM.SYSCOLUMNS and SYSIBM.SYSTABLES

Thanks,

John Herbold
IS Specialist/DBA

-----Original Message-----
From: Vinnie Lima
To: Anthony Nickolayev
Cc: [EMAIL PROTECTED]
Sent: 6/10/2003 10:37 PM
Subject: Re: How can I fetch column names?


Try this (I use mysql - thus your mileage can vary):

        $column_list = $connect->prepare("LISTFIELDS $oppanel_table") ;
        $column_list->execute() ;
        $column_list_numrows = $column_list->{NUM_OF_FIELDS} ;

        for ($x=0;$x < $column_list_numrows; $x++)
        {
      print "$column_list->{NAME}->[$x]" ;
         }

Took me forever to figure this out lol

V.

------------------------------------------------------------------------
----------------

This is a PRIVATE message. If you are not the intended recipient, please
delete without copying and kindly advise us by e-mail of the mistake in
delivery. NOTE: Regardless of content, this e-mail shall not operate to
bind CSC to any order or other contract unless pursuant to explicit
written
agreement or government initiative expressly permitting the use of
e-mail
for such purpose.
------------------------------------------------------------------------
----------------




 

                      Anthony

                      Nickolayev               To:
[EMAIL PROTECTED]

                      <dodger                  cc:

                      @rwl.buryatia.ru         Subject: How can I fetch
column names?                                                 
                      >

 

                      06/10/2003 04:33

                      AM

 

 





Greetings. Maybe the answer for my question will be RTFM, but i still
cant
find
it myself. The problem is: i need to fetch just list, contains column
names
- and
i dont know how to do it. I didnt find it in DBI manual page, and
anywhere
else.
Thanks anyway, and sorry for my english.






Reply via email to