lucy Posted September 24, 2009 Share Posted September 24, 2009 How can i manually enter a date into a mysql database field by using php and html. I am unsure on how to format the date and how to handle the date i.e. the value of 3 combo boxes (one for day, month and year). Any help would be great. Thanks, Lucy Quote Link to comment https://forums.phpfreaks.com/topic/175355-manual-insertion-of-date/ Share on other sites More sharing options...
smerny Posted September 24, 2009 Share Posted September 24, 2009 $date = $year."-".$month."-".$day; then you would be able to enter $date into your db Quote Link to comment https://forums.phpfreaks.com/topic/175355-manual-insertion-of-date/#findComment-924086 Share on other sites More sharing options...
lucy Posted September 24, 2009 Author Share Posted September 24, 2009 that makes it really obvious. And i could set the field type to varchar instead of char in order to enable the input of the " - " symbol? Thanks, Lucy Quote Link to comment https://forums.phpfreaks.com/topic/175355-manual-insertion-of-date/#findComment-924093 Share on other sites More sharing options...
smerny Posted September 24, 2009 Share Posted September 24, 2009 i figured your field type was date Quote Link to comment https://forums.phpfreaks.com/topic/175355-manual-insertion-of-date/#findComment-924095 Share on other sites More sharing options...
lucy Posted September 24, 2009 Author Share Posted September 24, 2009 doesnt matter much, i wont be doing any processing on this i.e. date differences, im only going to print this date out so a varchar would do i think? Thanks, Lucy Quote Link to comment https://forums.phpfreaks.com/topic/175355-manual-insertion-of-date/#findComment-924126 Share on other sites More sharing options...
fenway Posted October 3, 2009 Share Posted October 3, 2009 No -- never a VARCHAR for a DATE. Quote Link to comment https://forums.phpfreaks.com/topic/175355-manual-insertion-of-date/#findComment-929637 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.