Error when "POSTing" to another page

5 posts by 3 authors in: Forums > CMS Builder
Last Post: September 10, 2010   (RSS)

Hi all,

I'm getting the following error when I "POST" to another page:

Error: Field 'createdDate' doesn't have a default value

I'm not quite sure what this is but it does not show up when using mySQL v4.x but does when using mySQL v5.x

Any idea what causes this? I've tried narrowing it down but it's kind of hard when that's the only thing that shows up on the page.

TIA!

Eric

Re: [eduran582] Error when "POSTing" to another page

By Chris - September 9, 2010

Hi eduran582,

What page are you POSTing to? Can you please attach the complete PHP source code of the page?
All the best,
Chris

Re: [chris] Error when "POSTing" to another page

Hi Chris,

Thanks for responding. My mistake; I wasn't "POSTing" (got it mixed up with another). It was being "called":
include 'add_Current.php';
The "add_Current.php" takes (several) lines of text from a file and accesses the database, 'truncates' a defined table, loops through and loads each line of text as a record (putting each comma delimited field into a defined field) into the table, then closes the mySQL instance.

The first time the 'include' is called, it works fine. The second time it's called is IF the user hits the "refresh" button of the browser. Other code checks a couple of fields to see if they exist and if so, tells the user they have already added their "reservation". It's the second time, if called, when I get that error.

I have the same program running on a different host and the only difference is the 'backup' site is running mySQL 4.x and the production site is running mySQL 5.x

I tried to find a way to disable the 'refresh' on a web browser but haven't been successful so I tried using this method. Any suggestions are certainly welcome. I just don't want the user to be able to 'refresh' the page which will subsequently add yet another line of text and an additional duplicate 'reservation'.

If you'd still like to see the code, I can email it to you.

Eric

Re: [Jason] Error when "POSTing" to another page

Hi Jason,

That did the trick! In this case, I actually had to do that (enter some default values) for all those fields in the table where we cannot enter a value (createdDate, createdByUserNum, updatedDate, updatedByUserNum, dragSortOrder). When I 'call' this page from other areas of the program, I don't get that error. I'm guessing it must have something to do with the "refresh" or renewing of the information on that page.

Either way, it works now. Thanks for the, as usual, fine support!

Eric