?
Solved

StructFind Syntax?

Posted on 2008-10-26
2
Medium Priority
?
309 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 2000 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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

A web service (http://en.wikipedia.org/wiki/Web_service) is a software related technology that facilitates machine-to-machine interaction over a network. This article helps beginners in creating and consuming a web service using the ColdFusion Ma…
Lease-to-own eliminates the expenditure of hardware replacement and allows you to pay off the server over time. Usually, this is much cheaper than leasing servers. Think of lease-to-own as credit without interest.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

777 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