I see now...I'm not too familiar with arrays but I can see how they work. Thanks
>Ed Wong wrote: > >>ok...but I'm still confused. How do I know when a new row starts? >> >>Each row contains 5 entries. >> >> >You know that a row is done when you find the LF chr(10) - this is >controlled by the outer loop. > ><cfloop index="listrow" list="#results#" delimiters="#chr(10)#"> > >Each entry is got from the row using the inner loop. ><cfloop index="thiscol" list="#listrow#" delimiters="#chr(9)#=; ',"> > >You can do whatever you like with each column you get out of your row. >You can display it as you already have, ignore it or store it in a >variable. When your application has looped through the entries in your >row it will drop out of the inner loop and back into the outer loop to >get the next row. Before you get the next row you need to insert the >entries you found into your database. > ><!--- Start of the file ---> ><cfloop index="listrow" list="#results#" delimiters="#chr(10)#"> ><!--- Get a row from the file ---> > <cfset variables.arrEntryStore = arraynew(1)> > <cfloop index="thiscol" list="#listrow#" delimiters="#chr(9)#=; ',"> > <!--- Get a column from the row you have and store it in an array ---> > <cfset >variables.arrEntryStore[arraylen(variables.arraEntryStore)+1] = thisCol> > </cfloop> > <!--- All the columns in the row have been stored, so now write them >into the database ---> > <cfquery name="insertnewrow" datasource="mydsn"> > INSERT INTO myTable (entry1, entry2, entry3, entry4, entry5) > VALUES (variables.arrEntryStore[1],variables.arrEntryStore[2], >variables.arrEntryStore[3], variables.arrEntryStore[4], >variables.arrEntryStore[5]) > </cfquery> > <!--- Entry written to the database, now go back to the top of the >loop to get the next row > until the end of the file is found---> ></cfloop> ><!--- End of the file ---> > > >Stephen ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Protect your mail server with built in anti-virus protection. It's not only good for you, it's good for everybody. http://www.houseoffusion.com/banners/view.cfm?bannerid=39 Message: http://www.houseoffusion.com/lists.cfm/link=i:15:943 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/15 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:15 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
