I want it when a row gets inserted in a table the date only is inserted automatically. In phpMyAdmin
Name: c_date
Type: date
Length/ Value:
Null: No
the rest are blank.
But this sets the date to 0000-00-00.
Can someone please tell me how to?
Thanks
Null: No
This is your issue.
If null values aren't permitted, MySQL will convert an empty/null/invalid value into 0000-00-00
. If you permit null values, you should be good to go.
If you want a date to automatically be added when rows are created, consider a TIMESTAMP
field with a default of CURRENT_TIMESTAMP
.