<!--- query the old newsroom database--->

<cfquery name="news" datasource="newsadmin" dbtype="ODBC">
select * from pressreleasetable
ORDER by pressreleasedate DESC
</cfquery>

<!---Setup an array with a structure --->

<cfset oldnews = ArrayNew()>
<!---add others here later e.g. prsub,prcontent,date etc... --->

<Cfloop query="news">
        <cfset oldnews[news.currentrow] = StructNew()>
        <cfloop list=#news.ColumnList# index=fieldname>
                <cfset oldnews[news.currentrow][fieldname] = Evaluate("news." &
fieldname)>
        </cfloop>
</cfloop>

Should do the trick

Steve


> -----Original Message-----
> From: Darren Adams [mailto:[EMAIL PROTECTED]]
> Sent: 30 April 2001 15:28
> To: CF-Talk
> Subject: Arrays and Structures storing query values
>
>
> Can anyone lend me a hand ?
>
> I am trying to store one database in an array of structures then insert it
> into another database.
>
> I am only using one field at the moment but, there will be 9 that
> I want to
> copy over.
>
> What I am trying to do is to take PressReleaseHeader from the
> pressreleasetable.
>
> But it keep giving me errors.
>
> <!--- query the old newsroom database--->
>
> <cfquery name="news" datasource="newsadmin" dbtype="ODBC">
> select * from pressreleasetable
> ORDER by pressreleasedate DESC
> </cfquery>
>
> <!---Setup an array with a structure --->
>
> <cfset oldnews = ArrayNew()>
> <cfset oldnews[1] = StructNew()>
> <!---add others here later e.g. prsub,prcontent,date etc... --->
>
> <Cfoutput query="news">
>       <cfset oldnews[news.currentrow].headline = #pressreleaseheader#>
> </cfoutput>
>
>
>
> Darren Adams
> Web Developer
> Marketing Department
> Systems Union
>
> Office: 01252 55 6220
> Mobile: 07714 817 038
> Email: [EMAIL PROTECTED]
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to