php - Date value saving as 0000-00-00 00:00:00 into a TIMESTAMP field when the query seems to be in ok format

253

I have aevent table where the fields are like:

id  int(11)
event_id    int(11)
title   varchar(300)
url varchar(30)
tags    varchar(300)
end_date    timestamp
created_at  timestamp   

Now I am executing a query like:

INSERT INTO `events` 
(`event_id`, `title`, `url`, `tags`, `end_date`) 
VALUES 
('448761', 'event title', 'http://calendar.google.com/', 'reserve|call|urgent','2014-07-25 08:00:00')

I am generating the value of theend_date via the following code:

...
$end_date = date('Y-m-d H:i:s', strtotime($_POST['end_date']));
...

But after running the query the value stored at the DB is0000-00-00 00:00:00!!!! The query doesn't even give an error.

What I might be missing? How can I get rid of this?

Thanks in advance for the answer.

People are also looking for solutions to the problem: php - .htaccess url rewrite rules problems

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.