• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

display value

Explorer ,
Aug 08, 2008 Aug 08, 2008

Copy link to clipboard

Copied

1)I have the drop down box to display all different table names. When user selected one table from this dropdown then it passed it value to the next page.

2)On the next page, I have the query
<cfquery name="tableselected" datasource="#DSN#">
select * from #form.tableSelected#
</cfquery>

3)On this page, I want to display the Id for each record but I don’t know how since this is the dynamic page and it depended on what table they selected on #1.
<cfouput>
<cfloop index = "rowNum" from = "1" to = #qTableSelected.recordCount#>
#tableselected[Column][rowNum]#
<cfouput>
With this code, I was able to display all the name from this table but don't know how to display the id that associated with each name.
Thanks
TOPICS
Advanced techniques

Views

248

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 08, 2008 Aug 08, 2008

Copy link to clipboard

Copied

Loop throught the columnlist for the query. Details are in the cf reference manual under cfloop and cfquery.

If you don't have a manual, the internet does.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 08, 2008 Aug 08, 2008

Copy link to clipboard

Copied

yes i did that, please look at my latest edit.

Thx

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 08, 2008 Aug 08, 2008

Copy link to clipboard

Copied

LATEST
do it like this
<cfoutput query ="yourquery">
<cfloop List = "#yourquery.columlist# index = "ThisColumn">
#tableselected[thiscolumn][rownumber]
closing tags

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation