How to display the column names from a query.
Posted on 2003-11-10
OK, here is the problem.
I have a query:
<cfquery name="AllListings" datasource="Home4SaleByMe" cachedwithin = "#CreateTimeSpan(0, 6, 0, 0)#">
SELECT * FROM user975947.Listing ORDER BY #SortBy#
Now I never know how many columns there are, so I want to be able to loop through and list the actual column names from the database, like this (or something similar - you get the point). I would also like to see if the column equals a known name and do something.:
<cfif AllListings.columnName(i) = "ID">
This is the ID Column