March 14th, 2004, 12:43 PM
Retreiving fields from Access DB, Cold Fusion
I am retreiving all fields from a certain table in my Access DB and want to output the data in those fields on my page. The table is specified by the URL parameter, so I need the output to correspond with the correct table. So i cant simply just <cfoutput>#fieldname#</cfoutput> because the field names are different for each table.
Basically, is there a way to output all the info in a table without specifying the field names? Like a <cfoutput>#ALL#</cfoutput> or something?????
<cfquery datasource="XX" name="getRecords">
<cfset table = URL.record>
SELECT * FROM #table#
Thanks for your help, hope you understand what I'm saying!
March 14th, 2004, 04:03 PM
#queryname.ColumnList# will give you a comma-delimited list of the query columns
you can loop over those with a cfloop inside the main cfoutput
March 15th, 2004, 12:01 PM
I'd be throwing up a huge red flag on this approach, unless you truly have no security concerns. For example, if you have a table with user names and passwords, it would be trivial for a malicious user to alter the URL parameter and end up with a full list of all your users and passwords. Be careful.