ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 20th, 2005, 01:33 PM
mparker1113 mparker1113 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 254 mparker1113 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 29 m 48 sec
Reputation Power: 5
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>

Reply With Quote
  #2  
Old June 20th, 2005, 02:17 PM
Bastion Bastion is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 181 Bastion User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 4 h 25 m 11 sec
Reputation Power: 5
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?

Reply With Quote
  #3  
Old June 20th, 2005, 03:07 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,689 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 16 h 33 m 51 sec
Reputation Power: 53
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

Reply With Quote
  #4  
Old June 21st, 2005, 10:07 AM
mparker1113 mparker1113 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 254 mparker1113 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 29 m 48 sec
Reputation Power: 5
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.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > cfloop with nested query.


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT