View Full Version : How to trick DREAMWEAVER into writing an UPDATE RECORD

01-11-2012, 12:15 AM
I'm re-posting this as a new thread. It appears as a comment to another thread I had going, but I wanted it to be easier to find in a search...

Dreamweaver's server behavior for Update Record doesn't work correctly sometimes. The symptom of this is that when you try to fill in the popup form provided by the Server Behaviors/Update Record menu item, it doesn't allow you to choose form fields to update to the database if they are posted there by a previous page. It only allows you to choose them if they are bound to the database. This doesn't do any good, because you are updating a record with the information from the database you want to update, NOT with new information. Kind of weird...
But here's the way to get around it. ITs a bit tedious but it works.

1. On a clean php page, set up a form with the input fields matching the database fields you want to update.
This page is to be used as the RESULT page of a form submitted on a previous page where the UPdate Record won't work due to conflicts, etc.

2. Connect to the database table you want to update, and set up a new RECORDSET on the page.
3. Bind all the form fields to the appropriate database fields
4. Do an Update Record behavior based on this form. This will actually do nothing but update the record with the stuff that is already in the record, as noted above.

5. Delete the php code that sets up the record set. But, LEAVE THE Update Record code alone! It is correct.

6. Change the bindings of all the fields in the FORM to the $_POST[] variables passed from the form on the previous page. (Make sure the previous page form uses the POST, not the GET method.)

NOw, when you submit the form it will pick up the values in the form, which have been passed from the previous page's form.

01-11-2012, 02:22 AM
or learn a little php and code your own

01-11-2012, 03:00 AM
I don't understand your comment. Care to elaborate?

01-11-2012, 03:38 AM
be glad to elaborate.
what i meant was if this is php , updating is pretty basic, and easiertpo learn than hacking dreamweaver messy bloated code, and seems a bit redundant using it if you have to hack it to make it work.
I didnt mean to be obscure , just seen so many problems with the dw wizard and i dislike it

$id =$_POST['id'];
$first= $_POST['first'];
$second= $_POST['second'];

$sql6 = "Update position2 set First = '$first',Second= '$second' where id= '$id'";
simple update from form results

01-11-2012, 02:46 PM
Well, I really tried writing my own update record handler, and ran up against some arcane Dreamweaver crap anyway. That's why I did it this way. Its not pretty, but it works.