The code I originally wrote has morphed into the following with some help from others on the list. However I am getting an error. It seems to not like the attribute variable for the query. One other thing. The URL from Yahoo seems to like the symbols to be separated with a + sign and my code is not providing that but there does not appear to be an error because of it. Any help would be appreciated

Here is the error:
Attribute validation error for tag cfloop. The value of the attribute query, which is currently "qStockItems", is invalid. The Error Occurred in C:\CFusionMX\wwwroot\stock3.cfm: line 21
19 :  
20 : <!--- loop over the query from the cfhttp feed. --->
21 : <cfloop query="qStockItems">

Here is the code:

<!--- get all the symbols from the database --->
<cfquery name="qGetSymbols" datasource="stocks">
SELECT  sym
FROM  symbols
WHERE  exchg ='NYSE'
</cfquery>


<!--- get a list of all the symbols --->
<cfset lStockSymbols = valueList( qGetSymbols.sym )/>
<cfoutput>#lStockSymbols#</cfoutput><br>
<!--- get the symbols from the yahoo feed --->
<cfhttp url="">         method="GET"
        name="qStockItems"
        columns="Symbol,Change,LastTradedPrice"
        textqualifier=""
        delimiter=","
        firstrowasheaders="no">


<!--- loop over the query from the cfhttp feed. --->
<cfloop query="qStockItems">

<!--- and if the last traded price of this row isnt zero  --->

<CFIF qStockItems.LastTradedPrice NEQ 0.00>
  <!--- insert this row into the database  --->
     <cfquery name="qInsertStock" datasource="stocks">
    INSERT INTO stocks
      (Symbol,Change)
    VALUES
      ('#qStockItems.Symbol#','#qStockItems.Change#')
     </cfquery>
</CFIF>
</cfloop>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to