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

Label

Status
Not open for further replies.

TSO456

Technical User
Jul 23, 2001
57
US
Hello,

I have a Web page with multiple text labels written in cold fusion. I also have a SQL database connected to this web page. The SQL database has a reference table that contains the names of the text labels. I would like to make the text labels dynamic, meaning I would like to change the data in the label on my web page by using the SQL reference table. The SQL table looks like this
Column1: Column2:
Current Name Display Name

I would like to change the display name from the reference table that would automaticaly change in the web page. One last thing, I can not use SQL such as "%Like%" because I do not know what Display Name the user will use in the reference table. The code needs to be able to get the content of Display Name regardless.

Thank you
 
Code:
<CFQUERY name=&quot;qryColumnLabels&quot; datasource=&quot;...&quot;>
    SELECT Column1,Column2
      FROM tablename
</CFQUERY>

<CFSET strColumnLabels = StructNew()>
<CFLOOP query=&quot;qryColumnLabels&quot;>
   <CFSET strColumnLabels[qryColumnLabels.Column1] = qryColumnLabels.Column2>
</CFLOOP>

then when it comes time to use the labels, simply do:
Code:
<CFOUTPUT>#strColumnLabels.
Code:
columnName
Code:
#</CFOUTPUT>
where columnName is the value of Column1 for the label you want to display.






-Carl
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top