Jump to content

Recommended Posts

guys, im having a problem here thats making me crazy

 

im making a system and i want to insert the current date in the mysql. I have the field called 'data' in the DB, but when i make the code to insert all the other fields, including the 'data', its work perfectly... unless that damn date!

 

$query = "INSERT INTO news (id, titulo, mensagem, data) VALUES (NULL, '$titulo', '$mensagem', 'date(\"d/m/Y\")')";

 

whats wrong with that?

its stores in DB as '0000-00-00'.

:wtf:

 

Link to comment
https://forums.phpfreaks.com/topic/226781-how-do-insert-date-into-mysql-db/
Share on other sites

Hopefully the data type for the field is DATE or DATETIME as it should be, then you simply use MySQL's NOW() function.

 

yep, the field is set as DATE, and i used NOW() , but this is still inserting as 0000-00-00

 

arrrghhh

http://colalinux.blogspot.com/2011/02/insert-date-into-mysql-table.html

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.