Error when "POSTing" to another page

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

By eduran582 - September 9, 2010

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

By eduran582 - September 9, 2010

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: [eduran582] Error when "POSTing" to another page

By Jason - September 10, 2010

Hi Eric,

You just need to add a value for the field createdBy when you're creating a record. You can use the MySQL function NOW() as a value to put in the current timestamp as a value.

Give that a try. If you're still running into trouble, please attach add_Current.php to this thread and I can take a closer look at it for you.

Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/