On 8/6/00, [EMAIL PROTECTED] penned:
>Well, I have numerous categories such as Hard Drive, MOtherboard, etc. So
>on the first page, they choose the category they want to edit. If they
>choose motherboard, it will show them maybe 10 motherboards. Every part of
>the database is in an input field so they can go through and edit every
>price. In this industry as you know, prices are changing constantly. It
>would be so tedious to edit these prices one by one. Thats why I want to
>do it this way. If I can get a list of 20 CPU's and edit all the prices
>and click submit, it would really speed up this arduous task.
Oh. :) Well that should be easy also.
I would still do a form for editing entire items one by one, but I do
understand the price thing.
Do this query when you select a category to change prices on:
<CFQUERY DATASOURCE="#attributes.DSN#" NAME="getprices">
SELECT ProductID, ProductName, Price
FROM Categories, Products
Where CategoryID = #CategoryID# and Categories.CategoryID = Products.CategoryID
</CFQUERY>
Then output your form fields like this, using a hidden input field to
pass the product id of each item in the same order. Keep in mind you
can't use cfform because it won't allow duplicate field names.
<form action = "somepage.cfm">
<table border=1 cellspacing=2 cellpadding=2>
<CFOUTPUT query="getprices">
<tr>
<td>#ProductName#</td>
<td><input type="Text" name="prices" size="10" value="#replace(price,
",", "", "ALL")#">
<input type="hidden" name="ProductIDs"</td>
</tr>
</CFOUTPUT>
</table><p>
<input type="Submit" value="Edit Prices">
</form>
Then loop through the form.prices list that's passed adding 1 for
every loop to pick up the right ProductID for each price. Be sure you
don't pass any commas with your prices if something is over 1,000 or
1,000.00 will become 2 list items, 1 and 000.00. That's why I
stripped them out of the form value above.
<cfset row = 0>
<cfloop index="thisprice" list="#form.prices#">
<cfset row = row + 1>
<CFQUERY DATASOURCE="#attributes.DSN#">
UPDATE products
SET Price = #thisprice#
WHERE ProductID = #listgetat(form.ProductIDs, row)#
</CFQUERY>
</cfloop>
HTH
--
Bud Schneehagen - Tropical Web Creations
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
ColdFusion Solutions / eCommerce Development
[EMAIL PROTECTED]
http://www.twcreations.com/
954.721.3452
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.