The Insert statement depending on the data type of the column can record a value as shown below.
1 - No quotation marks
SQL, with column dataBd
being type 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, the column dataBd
being type Valores String
or Valores Numéricos
insert into usuarios (dataBd) values (2015-10-20)
Resultado: 1985
2 - With quotation marks
SQL, with column dataBd
being type Valores String
insert into usuarios (dataBd) values ('2015-10-20')
Resultado: 2015-10-20
SQL, with column dataBd
being type 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, with column dataBd
being type Valores Numéricos
insert into usuarios (dataBd) values ('2015-10-20')
Resultado: 2015
Conclusion
For columns of type type or string put quotation marks in the value
$query = "insert into usuarios (dataBd) values ('{$dataBd}')";