close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Adding an OrderShippedDate field to my Order mysql table? Not allowed two timestamp fields?

Thread began 4/17/2014 9:59 am by Nathon Jones Web Design | Last modified 4/17/2014 10:31 am by Jason Byrnes | 178 views | 1 replies |

Nathon Jones Web Design

Adding an OrderShippedDate field to my Order mysql table? Not allowed two timestamp fields?

I would like to add a date field to my Order table that logs when my client updates orders in their CMS as dispatched. We have a TINYINT field that does this, to simply indicate "Yes" or "No" for the dispatched status, and that works fine but I'd also like to log the date so that when a customer checks their order they can see a dispatch date.

I have tried creating another timestamp field in our table set to "ON UPDATE CURRENT_TIMESTAMP" however we receive an error on this because of the existing "OrderDate" field which is also a timestamp field...
"SQL Error (1293): Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause"

What is the solution here? I considered setting the field as a "DATE" field, but I'm not sure how to collect, in PHP, the current date and, for example, add it to a hidden form field in my client's CMS.

Related to this, I noticed that the OrderDate field is set to "ON UPDATE CURRENT_TIMESTAMP". If my client updates an order as shipped, in the CMS, won't that change the OrderDate date? Should I just change that default state to "CURRENT_TIMESTAMP" as opposed to "ON UPDATE CURRENT_TIMESTAMP"?

Would appreciate any help or advice that could be offered. Thank you.
NJ

Sign in to reply to this post

Jason ByrnesWebAssist

use a date field.

and add a hidden form element with the following code as the value to capture the current date:

<?php echo date("Y-m-d"); ?>




yes, the OrderDate field default value should be "CURRENT_TIMESTAMP" as opposed to "ON UPDATE CURRENT_TIMESTAMP" to prevent it being changed on update.

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