Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamic SQL

Status
Not open for further replies.

dasniper

Programmer
Apr 11, 2001
25
US
I'm writing a page that will go to the database and grab the fields the user wants and show them. I have the part where ColdFusion makes the Dynamic SQL statement absed on the user's preference, but I can't figure out how to actually display the results from the query.

I think I have to somehow get the list of fields from say ID,JobFunction,PurchaseWindow format to #ID#,#JobFunction#,#PurchaseWindow# and then show that list to CFOUTPUT, and it should be fine, but how do I change the list?
 
Hey,

Put the field form variable in a loop, like

<cfoutput query = yourquery>
<tr>
<cfloop index=&quot;thisfield&quot; list=&quot;#form.yourfieldlist#&quot;>
<td>#thisfield#</td>
</cfloop>
</tr>

</cfoutput>

HTH,
PH
 
When I do that, it comes out:

ID, Title, State, PurchaseWindow, JobFunction,
ID, Title, State, PurchaseWindow, JobFunction,
ID, Title, State, PurchaseWindow, JobFunction,

for the number of records in the CFOUTPUT
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top