close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 or 2018 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Multiple SQL statement in DataAssist

Thread began 8/17/2009 2:16 pm by david.barrack304604 | Last modified 8/18/2009 4:29 pm by Jason Byrnes | 1211 views | 3 replies |

david.barrack304604

Multiple SQL statement in DataAssist

I have a case where an update needs to be done however lots of updates are being done depending on a number of conditions. For example, If # rooms needed = 3 then set rate = 100, If # room needed = 4 then set rate = 150, etc. I was planning on doing this with a number of set statements back to back but not sure I can add that custom code to the query that Data Assist sends. Does that seem like the best approach. I was also considering stored procedures but not sure if the new implementation in MySQL 5 allows for multiple statements in one sp.

Sign in to reply to this post

Jason ByrnesWebAssist

You can create switch case statement to set a variable to the correct value, then bind the column to that variable in the DA Update Record server behavior.

For example, if the number of rooms needed is coming from a form element named "numberOfRooms":

php:
<?php

if(isset($_POST['numberOfRooms'])) {
$rate "";
switch (
$_POST['numberOfRooms']) {
    case 
"3"
      
$rate "100";
      break;
    case 
"4"
      
$rate "150";
      break;    
}
$_SESSION['rate'] = $rate;
}
?>




make sure this code is above the Update record code. No go to the bindings panel, click the plus button and Select Session Variable set the name of the session variable to "rate"

In the update Record behavior, you can bind the rate column to the rate session variable.

Sign in to reply to this post

david.barrack304604

location for custom code

Thank you. I was wrestling with whether to do some of this logic in SQL or php. I have never been sure where exactly to put code such as what you provided. I know it needs to be prior to where the submit logic sits but never exactly sure what the best location is. Can you please advise?

Sign in to reply to this post

Jason ByrnesWebAssist

Before the Insert Record or Update Record code.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...