How do I insert the current date to my database? I have a column called date to put it on.
I want to insert it at the same time I insert this:
$sql="INSERT INTO `Lines` (Text, PID, Position)
VALUES
('$text','$pid','$position')";
Is there a way to automate it in PHPMyAdmin or it’s the same to do it this way? Thanks
If the table definition has the
timestampcolumn default set toCURRENT_TIMESTAMP, you actually don’t have to do anything at all. Otherwise,NOW()andCURRENT_TIMESTAMPwill work, as in:There is a difference between
CURRENT_TIMESTAMPandNOW()but it’s probably too small to matter to you.phpMyAdmin seems like it has
CURRENT_TIMESTAMPas an option when creating a new column.