Hi
I have a batch feature i have developed to update the products table.
at this stage i have the check boxes updating and would now like to add a
text field for price.
the probelm i have is lining up the values so they insert the correct
details.
with the check boxes i have a simple system re below.
<!--- set featured specials and hidprod to no --->
<CFQUERY NAME="resetfeatured" datasource="#prefs.dsn#" >
UPDATE products
SET featured = 0
<cfif isdefined("form.featured")>
where productid NOT IN ('#form.featured#')
</cfif>
</CFQUERY>
<!--- loop over selected fields and update table --->
<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>
this works perfect for the check box enteries but not for products.
the problem for the products is lining up the values productid with the
values to be updated.
hope all this makes sense....
heres the code if anyone can point me in the right direction would be a
great help!
save the new data
<cfif isdefined("form.updateprice")>
<cfloop index='price' list='#form.price#' delimiters=','>
<cfloop index='item' list='#form.productid#' delimiters=','>
<CFQUERY NAME="updateprice" DATASOURCE="#prefs.dsn#">
UPDATE products
SET unitprice='#price#'
WHERE (productid = '#item#')
</CFQUERY>
</cfloop>
</cfloop>
</cfif>
this is the form that submits the data
<form action="Products.cfm" method="POST">
<input type="Hidden" name="updateprice" value="updateprice">
<table cellspacing="2" cellpadding="2" border="0">
<tr>
<td>Product Part No
Name</td><td>Featured</td><td>Special</td><td>Hide</td><td>Price</td>
</tr>
<cfoutput query="special">
<input type="Hidden" name="productid" value="#productid#">
<tr bgcolor="#IIf(CurrentRow Mod 2, DE('#prefs.rowcolor1#'),
DE('#prefs.rowcolor2#'))#">
<td>#productpartno# - #productname#</td>
<td><input type="Text" name="price" value="#unitprice#" size="5"
maxlength="10"> <cfif "#hiddenprod#" is "yes">checked</cfif></td>
</tr>
</cfoutput>
</table>
<input type="Submit" name="save" value="save changes">
</form>
regards greg
---
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/