Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ColdFusion / Getting Started / July 2008



Tip: Looking for answers? Try searching our database.

cfloop list error

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Tams87 - 25 Jul 2008 20:55 GMT
Hi,

I am trying to loop over a list and get results matching that list however, I
get the following error:

 [Macromedia][Oracle JDBC Driver][Oracle]ORA-00904: "1": invalid identifier
 
The error occurred in E:\ColdFusion8\wwwroot\MidWiferyLottery\test2.cfm: line
11

9 :     <cfquery name='test1' datasource='t_test'>
10 :         SELECT ID, FIRSTCHOICE FROM TBL_LOTTERY
11 :         WHERE FIRSTCHOICE="#i#"
12 :     </cfquery>
13 : </cfloop>

I have attached the code I am using.

Thanks in advance.

<cfquery name='test' datasource='t_test'>
    SELECT IDS FROM TBL_LOCATION
    WHERE IDS in (SELECT firstchoice from TBL_LOTTERY)
</cfquery>

<cfset myList = ValueList(test.ids)>

<cfloop list="#myList#" index="i">
    <cfquery name='test1' datasource='t_test'>
        SELECT ID, FIRSTCHOICE FROM TBL_LOTTERY
        WHERE FIRSTCHOICE="#i#"
    </cfquery>
</cfloop>
Dan Bracuk - 26 Jul 2008 04:10 GMT
Your error is caused by using double quotes.

Your approach is horrifically inefficient.  You only need 1 query.
Tams87 - 28 Jul 2008 15:03 GMT
Thank you, the quotes were the problem. As for the method, I am working on making it more efficient.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.