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

Specify data to display

New Here ,
Jan 23, 2009 Jan 23, 2009
Hi,
I pass form.name="a, b, c" from page 1 to page 2, where a, b, and c represent three corresponding columns in the source data table. On page 2, I want to display the data for a, b, and c. The problem is that the string in form.name may vary depending on the user choice. It can be "a, b, c" or "b, d" or something else. I need help in specifying the column names in a cfloop. Please see the attached code with question marks.

Thanks,
New to this forum

TOPICS
Getting started
790
Translate
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 ,
Jan 23, 2009 Jan 23, 2009
try #report[listitem][currentrow]#

it might work, or it might not.
Translate
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
New Here ,
Jan 23, 2009 Jan 23, 2009
It did not work. Thanks anyway!
Translate
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
Valorous Hero ,
Jan 23, 2009 Jan 23, 2009
> <cfquery datasource="#dsn#" name="report">
> select year, group, indicator, #form.name#
> from data
> </cfquery>

That is an invitation to sql injection.

> It did not work.

Did not work how? Without having tried it, it looks right.
Translate
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
New Here ,
Jan 23, 2009 Jan 23, 2009
I understand the risk of sql injection. Just use it to illustrate the problem.

#report[listitem][currentrow] did not work because after I substituted it for ??????, the web page came back blank.
Translate
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 ,
Jan 23, 2009 Jan 23, 2009
LATEST
quote:

Originally posted by: Natomas
I understand the risk of sql injection. Just use it to illustrate the problem.

#report[listitem][currentrow] did not work because after I substituted it for ??????, the web page came back blank.

What happens if you put this right before your table?
<cfdump var="#report#">
<cfflush>
Translate
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