ok i bring up the famous river flow example again

heres the idea
loop through the database and get and update each rivers flows

basic idea is to take the info, convert to a string, make a list and then breaking it down the doing db insert

sorry i dont have a lot of time to explain it
but hope it help :)

<!--- get river numbers for query --->
<cfquery name="qgetRecords" datasource="#dsn2#">
SELECT riverNumber
FROM flows
</cfquery>

<cfloop query="qgetRecords">
<!--- set river number into variable --->
<cfset riverNumber = #qgetRecords.riverNumber#>

<!--- retrieve info from USGS website --->
<cfhttp url="" "
method="get">
</cfhttp>

<!--- place contents into a formated variable --->
<cfset data = "">
<!--- set variables to insert into db --->
<cfset last = listLast(data, "USGS")>
<cfset riverNumber = listGetAt(last, 1, chr(9))>
<cfset dateTime = listGetAt(last, 2, chr(9))>
<cfset waterFlow = listGetAt(last, 3, chr(9))>
<cfset waterTemp = listGetAt(last, 4, chr(9))>
<cfset setDate = DateFormat(dateTime, "mmm-dd-yyyy")>
<cfset setTime = TimeFormat(dateTime, 'hh:mm:ss')>

<!--- insert the  contents of the form into the db --->
<cfquery name="addflows" datasource="flow">
UPDATE INTO  
SET riverNumber = #riverNumber#
, enteredDate = '#setDate#'
, enteredTime = '#setTime#'
, waterFlow = '#waterFlow#'
, waterTemp = '#waterTemp#'

WHERE riverID = '#qgetRecords.riverID#' ;
</cfquery>
</cfloop>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to