简体   繁体   中英

phpmyadmin, I have a problem in mysql database column with the constraint DEFAULT it's not working

how it has been configured: COLUMN valid_untill:

valid_untill DATETIME DEFAULT DATE_ADD( Referral_date` + interval 3 day)

COLUMN valid_untill is based on column referring_date:

referring_date it is also constraint DEFAULT: DEFAULT(CURRENT_TIMESTAMP).

when I insert a specific insert to the column it's working fine add 3 days to the date there is no bad planning overall column and table operate great but,

but when I did not give both columns a data, column referring_date gets the CURRENT TIMESTAMP(as it should) and the column doesn't get any column but zeros. (doesn't show null)

I want the column to get the current TIMESTAMP from the column referring_date and add 3 days to the current TIMESTAMP 3 days

if your question is if the two columns have the same type, yes their type is DATETIME.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM