close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Hand coding additional fields in an INSERT or UPDATE behaviour - why might this not be working?

Thread began 12/09/2022 4:47 am by Nathon Jones Web Design | Last modified 12/09/2022 12:14 pm by Ray Borduin | 136 views | 2 replies |

Nathon Jones Web Design

Hand coding additional fields in an INSERT or UPDATE behaviour - why might this not be working?

I have the following hand coded INSERT behaviour on a page:

<?php
if(!isset($_SESSION["SMCinUSERID"])) {
if (isset($_POST["btnADDSTEP1"]) || isset($_POST["btnADDSTEP1_x"])) {
$InsertQuery = new WA_MySQLi_Query($csdbmysqli);
$InsertQuery->Action = "insert";
$InsertQuery->Table = "SMCuser";
$InsertQuery->bindColumn("SMCuserUSER", "s", "".((isset($_POST["EmailConfirm"]))?$_POST["EmailConfirm"]:"") ."", "WA_DEFAULT");
$InsertQuery->bindColumn("SMCuserFIRST", "s", "".((isset($_POST["FirstName"]))?$_POST["FirstName"]:"") ."", "WA_DEFAULT");
$InsertQuery->bindColumn("SMCuserSUR", "s", "".((isset($_POST["Surname"]))?$_POST["Surname"]:"") ."", "WA_DEFAULT");
$InsertQuery->bindColumn("SMCuserPASS", "s", "$hashed", "WA_DEFAULT");
if (isset($_POST["savedetailsCHECK"] ) && $_POST["savedetailsCHECK"] == 1) {
$InsertQuery->bindColumn("SMCuserADD", "s", "".((isset($_POST["Address"]))?$_POST["Address"]:"") ."", "WA_DEFAULT");
$InsertQuery->bindColumn("SMCuserADD1", "s", "".((isset($_POST["Address2"]))?$_POST["Address2"]:"") ."", "WA_DEFAULT");
$InsertQuery->bindColumn("SMCuserCITY", "s", "".((isset($_POST["City"]))?$_POST["City"]:"") ."", "WA_DEFAULT");
$InsertQuery->bindColumn("SMCuserREGION", "s", "".((isset($_POST["Region"]))?$_POST["Region"]:"") ."", "WA_DEFAULT");
$InsertQuery->bindColumn("SMCuserCOUNTRY", "i", "".((isset($_POST["Country"]))?$_POST["Country"]:"") ."", "WA_DEFAULT");
$InsertQuery->bindColumn("SMCuserZIP", "s", "".((isset($_POST["Postcode"]))?$_POST["Postcode"]:"") ."", "WA_DEFAULT");
$InsertQuery->bindColumn("SMCuserPHONE", "s", "".((isset($_POST["Telephone"]))?$_POST["Telephone"]:"") ."", "WA_DEFAULT");
$InsertQuery->bindColumn("SMCuserMOBILE", "s", "".((isset($_POST["Mobile"]))?$_POST["Mobile"]:"") ."", "WA_DEFAULT");
$InsertQuery->bindColumn("SMCuserDOB", "t", "".((isset($_POST["DOB"]))?$_POST["DOB"]:"") ."", "WA_DEFAULT");
}
$InsertQuery->saveInSession("NEWuserID");
$InsertQuery->execute();
$InsertGoTo = "";
if (function_exists("rel2abs")) $InsertGoTo = $InsertGoTo?rel2abs($InsertGoTo,dirname(__FILE__)):"";
$InsertQuery->redirect($InsertGoTo);
}
}
?>



This all works fine. I needed to add two new fields to this INSERT:

<?php
if(!isset($_SESSION["SMCinUSERID"])) {
if (isset($_POST["btnADDSTEP1"]) || isset($_POST["btnADDSTEP1_x"])) {
$InsertQuery = new WA_MySQLi_Query($csdbmysqli);
$InsertQuery->Action = "insert";
$InsertQuery->Table = "SMCuser";
$InsertQuery->bindColumn("SMCuserUSER", "s", "".((isset($_POST["EmailConfirm"]))?$_POST["EmailConfirm"]:"") ."", "WA_DEFAULT");
$InsertQuery->bindColumn("SMCuserFIRST", "s", "".((isset($_POST["FirstName"]))?$_POST["FirstName"]:"") ."", "WA_DEFAULT");
$InsertQuery->bindColumn("SMCuserSUR", "s", "".((isset($_POST["Surname"]))?$_POST["Surname"]:"") ."", "WA_DEFAULT");
$InsertQuery->bindColumn("SMCuserPASS", "s", "$hashed", "WA_DEFAULT");
if (isset($_POST["savedetailsCHECK"] ) && $_POST["savedetailsCHECK"] == 1) {
$InsertQuery->bindColumn("SMCuserADD", "s", "".((isset($_POST["Address"]))?$_POST["Address"]:"") ."", "WA_DEFAULT");
$InsertQuery->bindColumn("SMCuserADD1", "s", "".((isset($_POST["Address2"]))?$_POST["Address2"]:"") ."", "WA_DEFAULT");
$InsertQuery->bindColumn("SMCuserCITY", "s", "".((isset($_POST["City"]))?$_POST["City"]:"") ."", "WA_DEFAULT");
$InsertQuery->bindColumn("SMCuserREGION", "s", "".((isset($_POST["Region"]))?$_POST["Region"]:"") ."", "WA_DEFAULT");
$InsertQuery->bindColumn("SMCuserCOUNTRY", "i", "".((isset($_POST["Country"]))?$_POST["Country"]:"") ."", "WA_DEFAULT");
$InsertQuery->bindColumn("SMCuserZIP", "s", "".((isset($_POST["Postcode"]))?$_POST["Postcode"]:"") ."", "WA_DEFAULT");
$InsertQuery->bindColumn("SMCuserPHONE", "s", "".((isset($_POST["Telephone"]))?$_POST["Telephone"]:"") ."", "WA_DEFAULT");
$InsertQuery->bindColumn("SMCuserMOBILE", "s", "".((isset($_POST["Mobile"]))?$_POST["Mobile"]:"") ."", "WA_DEFAULT");
$InsertQuery->bindColumn("SMCuserDOB", "t", "".((isset($_POST["DOB"]))?$_POST["DOB"]:"") ."", "WA_DEFAULT");
$InsertQuery->bindColumn("SMCuserBIRTHCITY", "s", "".((isset($_POST["BirthCity"]))?$_POST["BirthCity"]:"") ."", "WA_DEFAULT");
$InsertQuery->bindColumn("SMCuserBIRTHCOUNTRY", "i", "".((isset($_POST["BirthCountry"]))?$_POST["BirthCountry"]:"") ."", "WA_DEFAULT");
}
$InsertQuery->saveInSession("NEWuserID");
$InsertQuery->execute();
$InsertGoTo = "";
if (function_exists("rel2abs")) $InsertGoTo = $InsertGoTo?rel2abs($InsertGoTo,dirname(__FILE__)):"";
$InsertQuery->redirect($InsertGoTo);
}
}
?>



...but it just won't save those two new fields to DB. Everything else still works (inserts) though?
Is it not possible to hand code it like this?

I've not used DW for a while and am getting all kinds of warning messages when I open up pages. Something about various elements - Recordsets, Server Behaviours, eCart, DynTextField and more - not defining the "findServerBehaviours function".

Could this be related?
Would appreciate your advice.
Thank you.
NJ

Sign in to reply to this post

Nathon Jones Web Design

Ray, I've put the FTP details and information in the PM below. I've spent all day trying to work this out and haven't been able to work it out. Everything, bar the two new fields I've added, saves to database. Hoping you can spot what I haven't been able to. Thank you.

Sign in to reply to this post

Ray BorduinWebAssist

It is probably that your form action is still pointing to the old version of the page so your new code isn't running. Your updated code looks like it should work.

Sign in to reply to this post
Did this help? Tips are appreciated...

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...