The Insert declaration depending on the data type of the column can save a value as shown below.
1 - No quotation marks
SQL, being the column dataBd
of the kind Valores de Tempo
insert into usuarios (dataBd) values (2015-10-20)
Resultado (tipo DATE): 0000-00-00
Resultado (tipo DATETIME): 0000-00-00 00:00:00
SQL, being the column dataBd
of the kind Valores String
or Valores Numéricos
insert into usuarios (dataBd) values (2015-10-20)
Resultado: 1985
2 - With quotation marks
SQL, being the column dataBd
of the kind Valores String
insert into usuarios (dataBd) values ('2015-10-20')
Resultado: 2015-10-20
SQL, being the column dataBd
of the kind Valores Tempo
insert into usuarios (dataBd) values ('2015-10-20')
Resultado (tipo DATETIME): 2015-10-20 00:00:00
Resultado (tipo DATE): 2015-10-20
SQL, being the column dataBd
of the kind Valores Numéricos
insert into usuarios (dataBd) values ('2015-10-20')
Resultado: 2015
Completion
For time or string type columns put quotes in value
$query = "insert into usuarios (dataBd) values ('{$dataBd}')";
You have already tried to quote the SQL command:
('{$dataBd}')
? Without them the bank will interpret as integer values and perform the subtraction operation 2015-10-20 = 1985.– Woss
Friend thanks, it was quotes, sorry my mistake and thanks again for having helped me.
– William Gravina
if the column is of the
Valores de Tempo
there will be no sum no– user60252