php and mysql
~*Stephanie S asked:


I’m creating a blog website. When a user submits a new blog, I want the blog to be saved into my PHP database, along with the exact date and time that it was submitted.

For storing the date and time, I have a datetime field that is set to “not null”. I’ve tried leaving that field blank when I’m processing a blog submission:

insert into blogs values ‘$title’, ‘body’, ‘ ‘;
(notice the empty quotation marks)

but, when I do that, the field in the database is filled with zeros: 0000-00-00 00:00:00 . I’m using this field as my primary key, so I can’t have them all filled with 0’s!

How do I get the database to enter the current date and time? I’ve tried changing the field to a timestamp, but that didn’t help.

I’m using PHP 5.