Title: Message
This is a minor point, but if your productid was an integer, you could simply have
 
<CFQUERY NAME="updatefeatured" datasource="#prefs.dsn#" >
UPDATE     products
SET             featured=1
WHERE       (productid in #form.featured#)
</CFQUERY>
ie 1 query instead of n queries, where n is the number of products submitted in the form.featured field.
 
Even as a string, you could replace , with ',' and prepend/append ' and it would work with string values.
 
Just a suggestion - it looks like all your queries surrounded by CFLOOPs could use this.
 
Aaron
 
----- Original Message -----
Sent: Tuesday, June 15, 2004 4:38 PM
Subject: [cfaussie] RE: NEW batch style update request

Hi
for all those who contributed i settled on these updates.
 
 
<!--- loop over selected fields and update table --->
<cfif isdefined("form.featured")>
<cfloop index='item' list='#form.featured#' delimiters=','>
<CFQUERY NAME="updatefeatured" datasource="#prefs.dsn#" >
UPDATE     products
SET             featured=1
WHERE       (productid = '#item#')
</CFQUERY>
</cfloop>
</cfif>
 
<cfif isdefined("form.special")>
 
<cfloop index='item' list='#form.special#' delimiters=','>
<CFQUERY NAME="updatespecial" datasource="#prefs.dsn#" >
UPDATE     products
SET             special=1
WHERE       (productid = '#item#')
</CFQUERY>
</cfloop>
</cfif>
 
<cfif isdefined("form.hiddenprod")>
<cfloop index='item' list='#form.hiddenprod#' delimiters=','>
<CFQUERY NAME="updatehiddenprod" DATASOURCE="#prefs.dsn#">
UPDATE     products
SET        hiddenprod=1
WHERE       (productid = '#item#')
</CFQUERY>
</cfloop>
</cfif>
 
<cfloop index="x" from="1" to="#listlen(form.productpartno)#" step="1">
 <CFQUERY NAME="updateprice" DATASOURCE="#prefs.dsn#">
UPDATE     products
SET        unitprice= #listgetat(form.price,x)#
WHERE   productpartno = '#listgetat(form.productpartno,x)#'
</CFQUERY>
</cfloop>
 
 
regards greg
 

 
----- Original Message -----
Sent: Tuesday, June 15, 2004 4:29 PM
Subject: [cfaussie] RE: NEW batch style update request

I would recommend against this method
 
Not very efficient and your going to run into problems especially as your dealing with checkboxes aswell which unless they are checked wont get passed with your form and thus wont be available in your list, not to mention is i check one of the boxes, trying to work out which one actually got checked would be a nightmare
 
Steve
 
---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED] Aussie Macromedia Developers: http://lists.daemon.com.au/ ---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED] Aussie Macromedia Developers: http://lists.daemon.com.au/ ---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED] Aussie Macromedia Developers: http://lists.daemon.com.au/

Reply via email to