ShoeLace1291 Posted November 21, 2007 Share Posted November 21, 2007 How do I insert today's date in a certain database row without using the date() function for a string? For example, when you use PHPMyAdmin to insert a new table row and there's a column with the type "date", it gives you options such as CURDATE, NOW, etc. How would I use that in a database query? Link to comment https://forums.phpfreaks.com/topic/78198-todays-date-in-database-insertion/ Share on other sites More sharing options...
Wuhtzu Posted November 21, 2007 Share Posted November 21, 2007 Short answer isn't always the best, but always better than nothing http://www.gizmola.com/blog/archives/51-Exploring-Mysql-CURDATE-and-NOW.-The-same-but-different..html Link to comment https://forums.phpfreaks.com/topic/78198-todays-date-in-database-insertion/#findComment-395731 Share on other sites More sharing options...
BenInBlack Posted November 21, 2007 Share Posted November 21, 2007 if the field is datetime use now() if it is date use curdate() example INSERT INTO `iislogs` ( `ClientHost`, `Username`, `LogTime` ) values ('Host','User',now()); Link to comment https://forums.phpfreaks.com/topic/78198-todays-date-in-database-insertion/#findComment-395733 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.