Editing Database Records

Editing Database Records

Post by walt6 » Fri, 28 Oct 2005 03:15:43


I am trying to pass form data from a record on the confrimation page to another
page saying "Your record has been deleted / updated". I have tried using the
Dreamweaver Technote "How to pass form data from an insert, update or delete
page" and also Macromedia Dreamweaver Support Center "Editing DataBase
Records" but are STILL having trouble since it is NOT deleting or updating
the record. I am simply trying to accomplish these simple procedures [ modify
and deleting a record from a database using MySQL ] using Dreamweaver MX7.
Has ANYBODY encountered this problem before ??? Please HELP !!
 
 
 

Editing Database Records

Post by Stev » Fri, 28 Oct 2005 03:31:23

On Wed, 26 Oct 2005 18:15:43 +0000 (UTC), "walt69"



Does your form contain a hidden variable for the record you want to
delete (or update or whatever)?

eg if your form was confirming the deletion of record_id 73 from your
database (mytablename) you would have something like this in the form:

<input type="hidden" name="deleteID" value="73">

and then your SQL might look like:

$deleteSQL = sprintf("DELETE FROM mytablename WHERE record_id=%s",
GetSQLValueString($_POST['deleteID'], "int"));
--
Steve
steve at flyingtigerwebdesign dot com
Certifiable Dreamweaver Developer

 
 
 

Editing Database Records

Post by walt6 » Fri, 28 Oct 2005 20:31:12

Steve:

The form with the confirmation page that includes the record I wish to be
deleted DOES contain a HIDDEN FIELD where in the properties section binded it
to a dynamic source. See below

<input name="HiddenCustomerID" type="hidden" id="HiddenCustomerID"
value="<cfoutput>#rsDeleteCustomers.CustomerID#</cfoutput>">


My Delete SQL is as follows.

<cfif IsDefined("URL.HiddenCustomerID") AND #URL.HiddenCustomerID# NEQ "">
<cfquery datasource="chenegaportal">
DELETE FROM chenegaportal.customerform WHERE
CustomerID=#URL.HiddenCustomerID#
</cfquery>
<cflocation url="ThankYouDeleteCustomer.cfm">
</cfif>


I appreciate your insight to resolving this problem.
 
 
 

Editing Database Records

Post by Stev » Fri, 28 Oct 2005 20:42:02

On Thu, 27 Oct 2005 11:31:12 +0000 (UTC), "walt69"



I could be totally wrong here because I am a PHP person who has
forgotten all the CF he ever knew, but is it not working because you
are using POST for your form action but checking the URL for the
variable? Does URL.HiddenCustomerID refer to a vaiable in the URL and
should it not be FORM.HiddenCustomerID if you are using POST.

Sorry in advance if my suggestion is wrong for CF.
--
Steve
steve at flyingtigerwebdesign dot com
Certifiable Dreamweaver Developer