2014-02-28

I'm working on a Chat Room program and I want to have the time that a message was submitted to be recorded and shown, but I'm having problems (otherwise I wouldn't be here). The program records the date/time with the table as following:

When a message is submitted, it is supposed to record the current date/time when it was posted, and then later it is selected from the table, but my problem is the fact that it somehow records an illegal value and shows the data as: 0000-00-00 00:00:00 Even though I can get the date/time to display without much difficulty using the commented out part in the td id= time, but it only displays the current time and doesn't store it. Any help, please? I've search the web for an answer and haven't found a solution.

$result = mysqli_query($con,"SELECT * FROM $ChatTable");

This is where the information is inserted:

$posted_at= mysqli_query(date('YY-MM-DD','HH:MM:SS'));

Show more