turbosig
asked on
How to display the column names from a query.
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#
</cfquery>
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.:
<cfloop ...>
<cfif AllListings.columnName(i) = "ID">
This is the ID Column
<cfelse>
#AllListings.columnName(i) #
</cfif>
</cfloop>
I have a query:
<cfquery name="AllListings" datasource="Home4SaleByMe"
SELECT * FROM user975947.Listing ORDER BY #SortBy#
</cfquery>
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.:
<cfloop ...>
<cfif AllListings.columnName(i) = "ID">
This is the ID Column
<cfelse>
#AllListings.columnName(i)
</cfif>
</cfloop>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.