|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
cfloop with nested query.
Hi,
I am using cfloop to parse through a form inputted string. I then want to run a query using the differing values from the looped parsing. It doesn't look like the compiler is to happy with my attempts though, as it calls the asterix in my query's select statement an invalid parser construct. Should what I have below work? (CF 4.1.xxx) Code:
<cfloop from="1" to ="#LessorIteration#" index="i"> <!---LessorIteration = length lessor name/4: to give us num of times to look for strings 4 characters in length--->
<cfset LessorBroken = Mid(#form.Lessor#, (i * 4), 4)> <!--- start looking for smaller versions of string ---->
<!--- NoTE: will want to implement smaller breakdown for smaller lenght strings --->
<cfquery name="checkForDupes" datasource="Rents">
Select * from Rents where Lessor Like '*#LessorBroken*#' and Address Like'%#form.address#%'
</cfquery>
<cfoutput query="checkForDupes">
You have similar addresses at: #id#, #Lessor# <br>
</cfoutput>
</cfloop>
|
|
#2
|
|||
|
|||
|
What happens when you pull out i * 4 and assign it to a variable (i.e. <cfset midpointValue = i * 4>)? Does that throw an error?
|
|
#3
|
|||
|
|||
|
Select * isn't good practice anyway. I'd select the columns by name. Still, I'm not sure why it's complaining.
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian. How to Post a Question in the Forums |
|
#4
|
|||
|
|||
|
Thank you:
I had a syntax error where I put the wild card before the ending # sign for my cf variable. Still something wrong, but at least it appears to run now. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > cfloop with nested query. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|