How to input the current time into a mysql table from PHP

I'm using a mysql_query() in PHP to insert a value into a table in a database. One of the attributes of that table is "timestamp" which is supposed to be the current time that the query was made. How can I generate this? I tried using "time()" in PHP, but this is not inserting correctly in the query. When I insert what the time() function generates, it shows up as a default in my table, as: "0000-00-00 00:00:00". How can I generate the current time in order to input it into my table?

This question and answers originated from www.stackoverflow.com
Question by (4/27/2011 5:19:56 AM)

Answer

In your query, you need to set the value of that field to NOW() which is MySQL's function for getting a timestamp of the current time.

If you put your actual query in your question, I can help you with a more specific answer ;)

Answer by

Find More Answers
Related Topics  php  mysql  query  time  timestamp
Related Questions