ReeceSayer Posted May 9, 2009 Share Posted May 9, 2009 hi i need to know how to add the current date & time into my mysql table when i send information in a form using php... basically when i send my form i want it to record datetime also... i have a table named "datetime", using the DATETIME type Thanks Quote Link to comment https://forums.phpfreaks.com/topic/157515-solved-current-datetime-help/ Share on other sites More sharing options...
gevans Posted May 9, 2009 Share Posted May 9, 2009 <?php $query ="INSERT INTO `your-table` VALUES ('your-values', NOW())"; mysql_query($query) or die("Error: ".mysql_error()); NOW() should go into your datetime field Quote Link to comment https://forums.phpfreaks.com/topic/157515-solved-current-datetime-help/#findComment-830465 Share on other sites More sharing options...
Ken2k7 Posted May 9, 2009 Share Posted May 9, 2009 You can have MySQL do it by setting the DEFAULT value of the column to CURRENT_TIMESTAMP. Quote Link to comment https://forums.phpfreaks.com/topic/157515-solved-current-datetime-help/#findComment-830466 Share on other sites More sharing options...
ReeceSayer Posted May 9, 2009 Author Share Posted May 9, 2009 Problem solved... thanks guys Quote Link to comment https://forums.phpfreaks.com/topic/157515-solved-current-datetime-help/#findComment-830469 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.