Solved

StructFind Syntax?

Posted on 2008-10-26
2
283 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
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

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…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

809 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