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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Extracting query information

Status
Not open for further replies.

mickallen

Technical User
Jan 5, 2001
39
GB
I'm trying to extract query information from a resultset, the problem is I don't know the column headings as the query is created by the user.
I can get the column headings using query.columnlist but can't seem to use this within a cfoutput query.

Is there anyway to extract the query results without knowing the column headings.
 
Sure.
Something like:
Code:
<table border=&quot;1&quot;>
<tr>
    <CFLOOP list=&quot;#qryQueryName.ColumnList#&quot; index=&quot;sColumnName&quot;>
        <td><CFOUTPUT>#sColumnName#</CFOUTPUT></td>
    </CFLOOP>
</tr>
<CFOUTPUT query=&quot;qryQueryName&quot;>
    <tr>
        <CFLOOP list=&quot;#qryQueryName.ColumnList#&quot; index=&quot;sColumnName&quot;>
            <CFSET sColumnValue = qryQueryName[sColumnName]>
            <td>#sColumnValue#</td>
        </CFLOOP>
    </tr>
</CFOUTPUT>
</table>


-Carl
 
&quot;the query is created by the user&quot;

you know about sql injection, right?

just asking...

rudy
 
sorry for the delay in replying been away for a few days.
Thanks csteinhilber thats great.

r937 sorry but no I havn't heard of sql injection, what is it?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top