close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Quick mySQL query - blank date on update

Thread began 11/19/2014 11:54 am by iain331081 | Last modified 11/24/2014 9:39 am by Jason Byrnes | 2111 views | 12 replies |

iain331081

Quick mySQL query - blank date on update

I have an update page that includes a couple of date fields that often won't need to be used.

When the form updates, the value '30 November -0001' is being written to the database.

How can I stop this, so that it doesn't enter anything?

In the database in phpMyAdmin, I have the field as a Date field, allowing NULL, and a default value of NULL.

Thanks.

Sign in to reply to this post

Jason ByrnesWebAssist

send a copy of your page please.

Sign in to reply to this post

iain331081

Details below...

Sign in to reply to this post

iain331081

I guess its a quirk of mySQL as much as anything.

I had a look and found this sort of thing as a suggestion, e.g. adding:

<?php
if (isset($_POST["Update"])) {
if ($_POST['Date_Done_in_GIS'] != '') {
$_SESSION['Date_Done_in_GIS'] = ($_POST['Date_Done_in_GIS']);
} else {
$_SESSION['Date_Done_in_GIS'] = Null;
}
}
?>

And changing:

."" . $WA_AB_Split . "".((isset($_POST["Date_Done_in_GIS"]) && $_POST["Date_Done_in_GIS"]!="" )?date("Y-m-d H:i:s", strtotime($_POST["Date_Done_in_GIS"])):"")

to

."" . $WA_AB_Split . "".((isset($_POST["Date_Done_in_GIS"]) && $_SESSION["Date_Done_in_GIS"]!="" )?date("Y-m-d H:i:s", strtotime($_POST["Date_Done_in_GIS"])):"")

But without any luck.

If you know any tricks to force it to enter blank or NULL in the date field when the form is updated without those fields being populated that would be a great help.

Sign in to reply to this post

Jason ByrnesWebAssist

In the insert behavior, you have the data type for those columns set to text. change the data type to date instead.

Sign in to reply to this post

iain331081

What do I need to change? I don't see anything obvious in the behaviour code, and I can't see the behaviour listed in the Server Behaviour panel to edit.

Sign in to reply to this post

Jason ByrnesWebAssist

open the server behavior, on the bindings tab, select each of the date columns, it will show the Format and value selections below, set the format date instead of text.

Sign in to reply to this post

iain331081

Sorry if I'm having a moment, but how do I open the server behaviour? I'm looking in the Server Behaviours panel, but don't see it listed?

Sign in to reply to this post

Jason ByrnesWebAssist

looks like you have edited some code by hand to cause the server behavior to not be recognized.

send FTP Info and I can update it manually for you.

Sign in to reply to this post

iain331081

See below.

Sign in to reply to this post
loading

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