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

reserved characters

Status
Not open for further replies.

OccasionalCoder

Technical User
Sep 26, 2005
36
US
I want to pull some info from a database. The content of one of the fields in that database is "abbreviations" and it determines what information is to be presented on my page.


As an example, I have identified the page using <cfset page = "AFR">

I want to use that variable in my where statement, i.e., where abbreviation = #page#.

That works ok, except that I have several abbreviations that have a "/" character in them, i.e.: AFR/HE

How do I set my page name to AFR/HE and have it work in the select statement with the "/" ?

Thanks
 
Not sure I understand what the problem is. If you have it enclosed in quotes it should not be a problem... eg

Code:
select * from 
tabls where abbreviations = '#page#'


Is that what you were asking?
 
Here's the code I used:

<cfset page="AFRI/HEA">
<cfquery name="get_data" datasource="#db#" username="#un#" password="#pw#">
select * from fellows
where abbr = '#page#' and status = 'current'
order by 'last_name'
</cfquery>

This didn't return any data (it does exist in the database)

When I use this:

<cfset page="ARI">
<cfquery name="get_data" datasource="#db#" username="#un#" password="#pw#">
select * from fellows
where abbr = '#page#' and status = 'current'
order by 'last_name'
</cfquery>

it works fine. I'm assuming the / is the culprit.

Thanks again
 
are you sure there aren't any trailing spaces in the table like "AFRI/HEA " or maybe the abbr's are a little typeo'ed in the db or variable value? I know i have a bad habbit of saying pao&m when it's poa&m

We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true.
 
could you run this and see what the output is ?

<cfquery name="get_data" datasource="#db#" username="#un#" password="#pw#">
select count(1) from fellows
where abbr = 'AFRI/HEA' and status = 'current'
</cfquery>


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top