I just figured out my routine for updating a qty field in the clothing database so my client can keep track of inventory without manually updating.
I'm going to have her export these items as a csv daily. Then she can go to her admin and upload that file. I read it, then update the db. Here's what the csv looks like. ProductCode,Qty SHO1000NAVBLUELG,10 SHO1002BLUELG,25 There's NO way I have this done the best way. Could someone offer some tips on improvements? Thanks much! Here's my code: <cffile action="upload" filefield="file1" destination="C:\CFusionMX\wwwroot\winstoncourtsports\admin\cartorders" nameconflict="overwrite"> <cffile action="read" filefield="file1" variable="cartinfo" file="C:/CFusionMX/wwwroot/winstoncourtsports/admin/cartorders/#file.serverfile#"> <cfset cartinfo = #RemoveChars(cartinfo, 1,15)#> <cfloop list="#cartinfo#" index="cartitem" delimiters="#Chr(10)##Chr(13)#"> <cfset prodcode = #listfirst(cartitem, ",")#> <cfset prodqty = #listlast(cartitem, ",")#> <cfquery datasource="#DSN#" name="getprodqty"> SELECT prodID, prodqtyonhand FROM tblproducts WHERE prodID = '#variables.prodcode#' </cfquery> <cfset newqty = #getprodqty.prodqtyonhand#-#prodqty#> <cfquery name="updatedb" datasource="#DSN#"> UPDATE tblproducts SET prodqtyonhand=#variables.newqty# WHERE prodID = '#variables.prodcode#' </cfquery> </cfloop> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:192844 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

