Solved

StructFind Syntax?

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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

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 …
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…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now