Reply to Re: Retrieving fields name from mysql

Your name:

Reply:


Posted by Rich on 04/11/06 01:35

On 10 Apr 2006 06:56:41 -0700, Duderino82 wrote...
>
>I was wondering if there is a way to collect the names of the fields
>from a specific table. I think the soluction is to be researched in the
>sql code but maybe someone knows of a way to o so directly from php.
>
>Example.
>Table: Categories
>Field1: type1
>Field2: type2
>Field3: type3
>Field4: type4
>Field5: type5
>
>
>What I want is to be able to have an array (or an object) that cointans
>the name of the fields:
>
>array[0]=type1
>array[1]=type2
>array[2]=type3
>array[3]=type4
>array[4]=type5
>
>Any suggestions?
>


Depending on the SQL server you're using the command might be a little
different. As an example with MySQL I believe the syntax is..

DESCRIBE table_name;

Other SQL servers will have different commands. I think there's another though
in MySQL similar to...

SHOW COLUMNS FROM table_name;

Not sure how they differ so one may work out better for you when used in
conjunction with PHP.

Rich


--
Carry Forward Bandwidth! Included In All NewsGuy Accounts!
Don't lose what you don't use! - http://newsguy.com/overview.htm

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация