This isn't easy but... you can append the productid to each form field name
then when you update just get the id of the row to update off the end of the
form field name.

IE

Product 1
<input type="text" name="name1">
Product 2
<input type="text" name="name2">

Then on the update page do a ReReplace for alpha characters.

<cfloop index="ii" list="#form.fieldnames#">
        <cfset product_id =  ReReplaceNoCase(ii, "[a-z]", "", "ALL")>
        <CFQUERY name="update_products" datasource="datasource">
                UPDATE product
                SET name = #evaluate(ii)#
                WHERE product_id = #product_id#
        </CFQUERY>
</cfloop>

That should work.  Let me know if you need any help or a better
explaination.

--K

-----Original Message-----
From: Chris Farrugia [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 04, 2000 3:48 PM
To: [EMAIL PROTECTED]
Subject: Help with database updating page


Good day,

I am creating the site for my computer store, where a user will be able to
custom configure a new PC.  Currently I am stuck creating an administration
page where I can update the prices in my database.  The table has fields
(ProductID, CategoryID (Hard Drive, Motherboard, etc), Description, Price,
Weight).  I want on the admin page for there to be all of the products
listed in form text boxes.  If I want to edit one, I can change the content
of that text box and then hit the submit button and it edits the database.
The problem I'm running into is that I can't name the form fields the same
thing because then it won't know which to edit...  Can anybody explain how I
would do this?  I am very new to coldfusion.  Thank you for the help.

Sincerely,
Chris Farrugia

----------------------------------------------------------------------------
--
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.

------------------------------------------------------------------------------
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.

Reply via email to