On 8/5/00, Chris Farrugia penned:
>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

I'm not sure if I'm reading this right, but are you trying to show 
all the fields for all the products on one page? If so, every time 
you edit something ColdFusion will have to update every field of 
every product. You are much better off having a page listing all of 
the products in a select menu, choosing the product you want to edit 
and then showing the update form for that product only. At this point 
you simply have a hidden form field <input type="hidden" 
name="ProductID" value="#GetProduct.ProductID#"> and then pass that 
along to the update query with the rest of the form fields. Then you 
only have to update the fields for that product rather than updating 
every field for every product even if you're only changing one field.

<CFQUERY DATASOURCE="mydatasource">
UPDATE Products
SET Hard Drive = '#Form.HardDrive#',
Motherboard = '#Form.Motherboard#',
Description = '#Form.Description#',
Price = #Form.Price#,
Weight = #Form.Weight#
WHERE ProductID = #Form.ProductID#
</CFQUERY>

-- 

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.

Reply via email to