1.11M Members

Inserting a date into a database

 
0
 

Hi all. As a hobby I've been working on making a website with PHP and MySQL, both of which I am new to. I'm having some trouble with the comments system as I can't seem to be able to insert a date into the database. After the "insert", when I check it, no date has been entered and the date defaults to 01 Jan 1970.

$arr['postDate'] = date('j F Y', date());

	mysql_query("	INSERT INTO comments(author,subject,email,comment,article_id,postDate)
					VALUES (
						'".$arr['author']."',
						'".$arr['subject']."',
						'".$arr['email']."',
						'".$arr['comment']."',
						'".$arr['article_id']."',
						'".$arr['postDate']."'
					)");

The column where the date is to be inserted is of type date. I figured this was a simple problem and that I could work it out from other examples but it seems to be taking me a lot longer than expected. I'd apreciate any help you can offer.
Thanks.

 
0
 

A mysql date needs to be in the format '2011-09-23'

Question Answered as of 2 Years Ago by pritaeas
You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: