How do I show the date and time after the user sends a message?
I created a column named 'date' of type 'DATETIME' in the database.
In php I used the following code to insert the data:
Inserir.php
$sql = "INSERT INTO autoriza (ID, data) VALUES( '$id', 'NOW()')";
$acao_sql = $mysqli->query($sql);
Lista.php
$sql = "SELECT * FROM autoriza ORDER BY ID DESC";
$acao_sql = $mysqli->query($sql);
while ($lista = $acao_sql->fetch_array(MYSQLI_ASSOC)){
echo "Recado enviado em: ".$lista['data'];
}
The above result shows: 0000-00-00 00:00:00