Solved

StructFind Syntax?

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

Flexible connectivity for any environment

The KE6900 series can extend and deploy computers with high definition displays across multiple stations in a variety of applications that suit any environment. Expand computer use to stations across multiple rooms with dynamic access.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
iis reverse proxy virtual directory 8 239
how can I backup my incomplete website from hostgator? 3 73
Question to locate the problem 18 133
setup wamp server for first time 2 102
This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
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.

726 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