close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Do not update if no value in input or update as NULL to Date field IF empty

Thread began 4/24/2016 9:34 pm by Steve | Last modified 4/26/2016 11:08 am by Ray Borduin | 1146 views | 2 replies |

Steve

Do not update if no value in input or update as NULL to Date field IF empty

Hello,
I have a simple input using Jquery Datepicker, MySQL Date field with a NULL allowed.

Can't get a blank entry to leave the NULL or Update as NULL when no data / values is selected / present.

Tried:
$UpdateQuery->bindColumn("birthday", "t", "".((isset($_POST["datepicker"]))?$_POST["datepicker"]:"") ."", NULL);

$UpdateQuery->bindColumn("birthday", "t", "".((isset($_POST["datepicker"]))?$_POST["datepicker"]:"") ."", "WA_IGNORE");

$UpdateQuery->bindColumn("birthday", "t", "".((isset($_POST["datepicker"]))?$_POST["datepicker"]:"") ."", "WA_NULL");

Everytime the DB sets "1969-12-31" as the value when the field is empty.


Anyway to leave the Default NULL alone unless there really is a value being set?

Sign in to reply to this post

Ray BorduinWebAssist

It looks like there is a bug in the code.

Update this section in the queryobj.php file:

php:
$paramValue = strtotime($paramValue);

        if ($hasTime) {
          $paramValue = date('Y-m-d H:i:s',$paramValue);
        } else {
          $paramValue = date('Y-m-d',$paramValue);
        }


and wrap it in an IF statement like:

php:
if ($paramValue) {

          $paramValue = strtotime($paramValue);
          if ($hasTime) {
            $paramValue = date('Y-m-d H:i:s',$paramValue);
          } else {
            $paramValue = date('Y-m-d',$paramValue);
          }
                }



The code that we have to update the syntax of date columns to a format that MySQL recognizes is still running even when no value is entered and causing this problem.

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

Steve

That works Ray. Thanks!

Gonna need to update your Behavior soon so everyone gets all these little tweaks and bug fixes.

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