Connecting Tech Pros Worldwide Forums | Help | Site Map

Counting Database Fields

TristaSD
Guest
 
Posts: n/a
#1: May 11 '06
I am trying to build a sortable list of rows pulled from MySQL. I need
a programmatic header that would allow sorting of records. Because
order in which the fields are displayed might change, I need to learn
how to refer to field names programmatically.

Thanks!


Colin McKinnon
Guest
 
Posts: n/a
#2: May 11 '06

re: Counting Database Fields


TristaSD wrote:
[color=blue]
> I am trying to build a sortable list of rows pulled from MySQL. I need
> a programmatic header that would allow sorting of records. Because
> order in which the fields are displayed might change, I need to learn
> how to refer to field names programmatically.
>[/color]

if you do mysql_fetch_assoc() you'll get an associative array where the keys
are the attributes from the query.

You can also treat the output of 'DESC mytable' in much the same way you
would 'SELECT fld1, other FROM some_data'

HTH

C.

Closed Thread