Doubt mysql query + php

0

I generate a date in PHP and save it in the database:

$today = date('Y-m-d H:i:s');
$timestamp = strtotime($today);

In the bank it is saved in this format: 1474496101

When I do a SELECT in this field using the query below for example, NOT TURNED OUT.

SELECT * FROM teste.data WHERE data = FROM_UNIXTIME(1474496101) 

Can anyone tell me why?

    
asked by anonymous 06.10.2017 / 22:46

1 answer

1

I discovered it!

In the database can not be unixtime format has to be formatted as timestamp for example: 0000-00-00 00:00:00.

I took the test now and it worked. Anyway thanks Anderson, your comments led me to the solution.

    
06.10.2017 / 23:25