Skip to main content
Participating Frequently
January 23, 2009
Question

Specify data to display

  • January 23, 2009
  • 2 replies
  • 850 views
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

This topic has been closed for replies.

2 replies

Inspiring
January 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.
NatomasAuthor
Participating Frequently
January 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.
Inspiring
January 23, 2009
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>
Inspiring
January 23, 2009
try #report[listitem][currentrow]#

it might work, or it might not.
NatomasAuthor
Participating Frequently
January 23, 2009
It did not work. Thanks anyway!