Forum Moderators: coopster
The goal of the script is to insert in a mysql table different values submitted with $_POST method. The 'Created' field is designed to hold the date and time whenever a message is sent to database.
However that field receives the date part and NEVER the time part as intended in the script above.
Which function should I use so that the field shows also the time at which the message was inserted(not only the date part)?
Note: The arguments of the mktime functions are not mentionned here as it's not necessary to show them.
Thanks.
I think it's most likely that the database field is the 'date' type, not the 'datetime' type that you need to store the time as well.
Keep in mind that you can also use the following syntax (depending on the dataebase) to add the current date/time for you:
$sql = "INSERT INTO articles(name, email, subject, message, created )
VALUES('$y_name', '$email', '$subject', '$message', now())";