Solved

StructFind Syntax?

Posted on 2008-10-26
2
304 Views
Last Modified: 2013-12-24
Hi,

I am trying to use the function StructFind, but I think I have this syntax slightly off, I am hoping a second set of eyes can assist.  I am doing an insert into the database.  Here is the sql snippet.  I am not using any named arguments into this CFC, so that is the reason the structure is called "arguments[1]".  In any case, my problem seems to be related to my use of the # signs.

Is there anyone way to write this?

Thanks,

-ws



<cffunction name="doSomething" access="public">
<cfset var strResult = "" />
 
<cfloop from="1" to="3" index="i">
 
INSERT INTO TableA (
phase_description
)
 
VALUES(
'#StructFind(arguments[1], 'phase_description_' & "#i#" )#'
)
 
</cfloop>
<cfreturn strResult />
</cffunction>

Open in new window

0
Comment
Question by:Westside2004
[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
2 Comments
 
LVL 10

Accepted Solution

by:
Mr_Nil earned 500 total points
ID: 22808827
StructFind(arguments[1], 'phase_description_' & i )

or

StructFind(arguments[1], 'phase_description_#i#' )

The first is most likely to work.

You should also be using cfqueryparam in that insert, otherwise you have the potential to leave your application open to the delights of SQL Injection attacks.
0
 
LVL 1

Author Comment

by:Westside2004
ID: 22808845
Yes, I removed that to simply my posting, I am using <cfqueryparam>

Thanks your code worked.

-ws
0

Featured Post

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

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

If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

707 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