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.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.