I'm trying to insert the current date into a table, I'm using the following code:
insert into testar (data,nome) VALUES (date("Y-m-d H:i:s"),'pedro');
But the error:
Column 'data' can not be null.
I'm trying to insert the current date into a table, I'm using the following code:
insert into testar (data,nome) VALUES (date("Y-m-d H:i:s"),'pedro');
But the error:
Column 'data' can not be null.
Make use of CURRENT_TIMESTAMP
INSERT INTO testar (data,nome) VALUES (CURRENT_TIMESTAMP,'pedro')
Use NOW () to put the current date.
INSERT INTO testar
(data, nome)
VALUES
(NOW(), 'Pedro')
You can use the NOW () command so it would look like this:
insert into testar (data,nome) VALUES (NOW(),'pedro');