Gallery MX
MXMANIA Gallery MX FOR DREAMWEAVER
Free Applications
Album MX Basic
Calendar MX Basic
Asp Upload-Resize...
Private Messaging
User Tracking
Mail Multiple Users
Batch Update/ Delete
File Upload Manager
MXMANIA FILE UPLOAD MANAGER FOR DREAMWEAVER
Insert or Update the same Request/ Form Variable in multiple Fields of Database Table:

Unfortunately by default it is not possible to Insert or Update the same Request/ Form Variable in multiple Fields of Database Table while using DW Insert/ Update Server Behaviour.

So what to do now? There are maybe some extensions or code snippets out there which are really helpful, but with a little handcoding you can achieve this easily in mater of seconds.

The only disadvantage is that you will see the boring Red exclamation mark (!) next to your Insert/ Update SB, which atleast does not bothers me as long as the code works. So lets start:

Lets say we have three Fields named fld_name, fld_detail and fld_from in our Database Table.
Lets insert a Form and three textfields ( textfield1, textfield2, textfields3).

Now We want to insert the one of the "textfield" values twice i.e. the Fields "fld_name" & "fld_from" should contain the value in textfield1

Run your Insert / Update SB asuall so that you insert the values in the textfield1, textfield2, textfields3 in the Database Fields fld_name, fld_detail and fld_from respectively.

Now go to code view and find the part of the code that some how looks like this:

MM_fieldsStr = "textfield1|value|textfield2|value|textfield3|value"
MM_columnsStr = "fld_name|',none,''|fld_detail|',none,''|fld_from|',none,''"

What we have here is three textfields ( textfield1, textfield2, textfield3) whose values are to be inserted in the Database Fields fld_name, fld_detail and , fld_from respectively

Let say we want to insert the value of textfield2 in the Database Fields fld_name and fld_from. All you have to do is modify the BOLD part (MM_fieldsStr =) of the code:

MM_fieldsStr = "textfield1|value|textfield2|value|textfield3|value"
MM_columnsStr = "fld_name|',none,''|fld_detail|',none,''|fld_from|',none,''"

to


MM_fieldsStr = "textfield1|value|textfield2|value|textfield1|value"
MM_columnsStr = "fld_name|',none,''|fld_detail|',none,''|fld_from|',none,''"

you see the difference we have replaced textfield3 with textfield1. This way your Database Fields fld_name and fld_from will have the same value as in the textfield1.
Similarly you can repeat the procedure for any other values.

I hope you find this useful. Any questions? Post them in the Mxmania Forums (Tutorial Section)

Printer Friendly version

 

 

Calendar MX Pro
MXMANIA CALENDAR MX PROFESSIONAL FOR DREAMWEAVER
Useful Tutorials
Bandwidth Redirect
Extra session variables
Insert in2 Multiple Table
Regional Date Format
Form Validation
Update multiple records
Nested repeats