Cyberspace Posted April 11, 2008 Share Posted April 11, 2008 Im trying to add the current date in a mysql database, but im not sure if im on the right track: Im using the following sql insert statement: mysql_query("INSERT INTO walker (MemberRef, WalkNo, DateJoined) VALUES ('$MemberRef', '$WalkNo', NOW()"); Can i use date(Now) to insert the current date? Link to comment https://forums.phpfreaks.com/topic/100708-inserting-date-into-database/ Share on other sites More sharing options...
rhodesa Posted April 11, 2008 Share Posted April 11, 2008 mysql_query("INSERT INTO walker (MemberRef, WalkNo, DateJoined) VALUES ('$MemberRef', '$WalkNo',NOW())"); Assuming DateJoined is one of the Date datatypes Link to comment https://forums.phpfreaks.com/topic/100708-inserting-date-into-database/#findComment-515063 Share on other sites More sharing options...
discomatt Posted April 11, 2008 Share Posted April 11, 2008 If DateJoined is a datetime type column, the query you posted should work fine Link to comment https://forums.phpfreaks.com/topic/100708-inserting-date-into-database/#findComment-515066 Share on other sites More sharing options...
benphp Posted April 11, 2008 Share Posted April 11, 2008 nevermind Link to comment https://forums.phpfreaks.com/topic/100708-inserting-date-into-database/#findComment-515068 Share on other sites More sharing options...
Cyberspace Posted April 11, 2008 Author Share Posted April 11, 2008 mysql_query("INSERT INTO walker (MemberRef, WalkNo, DateJoined) VALUES ('$MemberRef', '$WalkNo',NOW())"); Assuming DateJoined is one of the Date datatypes Thanks for that Link to comment https://forums.phpfreaks.com/topic/100708-inserting-date-into-database/#findComment-515070 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.