?
Solved

Nested # signs - variable cfquery

Posted on 2003-03-29
4
Medium Priority
?
598 Views
Last Modified: 2013-12-24
I am sending a variable from one page to the next  called "person" - via http://page.cfm?person=#person#

the cfquery on page 2 looks like this:

<cfquery "address" datasource="whatever">
SELECT #person#
FROM book
</cfquery>

All i want to do is return a list of the row data from the column person; however, I have run into nested pound signs in my cfloop, i.e.:

<cfoutput>#address.#person##</cfoutput>
returns - an error about the "."

or if cfoutput query is used:

<cfoutput query="address">#person#</cfoutput>
returns - the variable value (i.e. Bob) for every datarow in table

any easy solution to this?

I tried put the variable together with <cfset> - if didn't work. I know I have incountered this before - just can't remember how I fixed it.

thanks for any help
0
Comment
Question by:flood92
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 8

Accepted Solution

by:
TallerMike earned 200 total points
ID: 8231425
<cfoutput>#Evaluate("address.#person#")#</cfoutput>

Or this:

<cfoutput>#Evaluate("address." & person)#</cfoutput>

Or this:

<cfoutput query="address">#Evaluate(person)#</cfoutput>
0
 
LVL 12

Expert Comment

by:jyokum
ID: 8231599
are you sure your query is right? if #person# resolves to Bob, your query is basically

<cfquery "address" datasource="whatever">
SELECT Bob
FROM book
</cfquery>

all this will return is the string "Bob". You probably want something like:
SELECT column_name
FROM book
WHERE person = '#person#'
0
 
LVL 17

Expert Comment

by:anandkp
ID: 8232831
A combination of above 2 suggestions shld help u out !

K'Rgds
Anand
0
 

Author Comment

by:flood92
ID: 8234314
Thanks TallerMike that worked.

jyokum - the query is right - "Bob" would be the datatable column name, i.e. I am selecting a column and displaying everything in the column. Bob would click on his name on the page to show his list of data on the next page.

Thanks again
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question