I have this query
"INSERT INTO front_articles (poster_id, username, title, message, date)
VALUES ('$poster_id', '$db_username', '$title', '$text',NOW()";
But when I read it off database it only shows 2013-10-05, what do I do for it to show time too?
Your date
column is of type date
. You can only save a date in it. Change it to datetime
to save both.
Change your database table column type datetime
instead of date
If you want to insert always NOW()
and not sth. like "2013-10-04 13:22:00" you can use the column type timestamp
.
NOW() Returns the current date and time as a value in 'YYYY-MM-DD HH:MM:SS'
format
So you could modify your date column as datetime
and also close the bracket )
at the end of inputed values
Your query as
INSERT INTO front_articles (poster_id, username, title, message, date)
VALUES ('$poster_id', '$db_username', '$title', '$text',NOW());