Ok I am trying to pull a feed from moreovernews.com. I have it set up
where I just go out and get the feed from the many they have
available (WDDX). I am trying to categorize the information, but with
the code below it only puts the information from the first query into
the headline table.
I am looping though the headlines and the feeds but somehow it isn't
updating getfeed.section on susequent loops.
It may be easier to understand by looking at the code. I have
expanded the code a bit for debugging, but still can't find an
answer.
thanks,
Tim Hill
<!--- Added loopcount to give it a different query name each time
--->
<cfset loopcount = 0>
<!--- Select feeds available from database Tables: feed_id, url,
section--->
<cfquery name="getfeed" datasource="news" dbtype="ODBC">
select * from feeds
</cfquery>
<!--- Loop through each URL from the table feeds --->
<cfloop query="getfeed">
<cfset loopcount = loopcount + 1>
<!--- get WDDX from the url --->
<cfhttp url="#getfeed.url#" method="GET"></cfhttp>
<!--- Write some output for debugging --->
<cfoutput><b>#getfeed.url# / #getfeed.section# / </b><br></cfoutput>
<!--- Change package from WDDX to CF Query --->
<cfwddx action="WDDX2CFML" input="#CFHTTP.FileContent#"
output="a#loopcount#">
<!---
columns:url,headline_text,source,media_type,cluster,tagline,document_u
rl,har
vest_time,access_registration,access_status --->
<!--- Loop through each headline --->
<cfloop query="a#loopcount#">
<!--- check and see if the article is already in the database --->
<cfquery name="checkdup" datasource="news" dbtype="ODBC">
select news_id from news where headline = '#headline_text#' and
harvest_time = '#harvest_time#'
</cfquery>
<!--- If it is not found insert it into the database --->
<cfif checkdup.recordcount EQ 0>
<!--- Insert the news headline, and include the section from
previous query (getfeed) --->
<cfquery name="addnews" datasource="news" dbtype="ODBC">
insert into news
("headline", "url", "harvest_time", "section")
VALUES
('#headline_text#', '#url#', '#harvest_time#',
'#getfeed.section#')<--------- this always has the information from
the row in the first query, WHY!!!!!!
</cfquery>
<!--- Write some output for debugging --->
<cfoutput>Wrote #headline_text# with section #getfeed.section# from
#getfeed.url#<br></cfoutput>
<!--- Close Dupcheck CFIF --->
</cfif>
<!--- Close headline loop --->
</cfloop>
<!--- Close the top loop from query getfeed --->
</cfloop>
<!--- Delete last update information --->
<cfquery name="del" datasource="news" dbtype="ODBC">
delete * from lastupdate
</cfquery>
<!--- Write new time --->
<cfquery name="lastupdated" datasource="news" dbtype="ODBC">
insert into lastupdate ("done") VALUES (1)
</cfquery>
<!--- EOF --->
-- Timothy C. Hill, [EMAIL PROTECTED] on 05/24/2000
-- Timothy C. Hill, [EMAIL PROTECTED] on 05/24/2000
------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebarRsts&bodyRsts/cf_talk or send a message
to [EMAIL PROTECTED] with 'unsubscribe' in the body.