Jump to content

Recommended Posts

Working on a small calendar project where there is an event date and display dates -- on and off. I have controled this with three fields in mysql: event_date, date_on, and date_off. All of the fields default to 0000-00-00, but I'd like to change that to today's date for date_on, and have date_off default to whatever is sent in event_date (which might not even be possible). One thing's for sure -- refman says I'd have to change all to the timestamp type to do anything like this (and I can only record the current timestamp).

So, is all hopeless in mysql and must be hardcoded in php?

idea:
viewing a particular calendar page could fire something like this
[code]UPDATE `table` SET `date_on` = DATE_ADD(`event_date`, INTERVAL -1 MONTH); WHERE `date_on` = '0000-00-00'[/code]
will that work?
Link to comment
https://forums.phpfreaks.com/topic/9712-dynamic-field-default/
Share on other sites

[!--quoteo(post=374283:date=May 16 2006, 09:28 AM:name=fenway)--][div class=\'quotetop\']QUOTE(fenway @ May 16 2006, 09:28 AM) [snapback]374283[/snapback][/div][div class=\'quotemain\'][!--quotec--](minus the extraneous semi-colon).
[/quote]

oops -- old habits die hard [img src=\"style_emoticons/[#EMO_DIR#]/laugh.gif\" style=\"vertical-align:middle\" emoid=\":laugh:\" border=\"0\" alt=\"laugh.gif\" /]
Link to comment
https://forums.phpfreaks.com/topic/9712-dynamic-field-default/#findComment-36244
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.