I had a database that had a perfectly working NOW() function, displaying the right date. And after accidentally deleted it, I created a similar database, but when I inserted NOW
You have quotes around the NOW()
function. Change it to:
INSERT INTO `blog_details` (`title`, `blog_content`, `blog_date`, `cat_name`)
VALUES('Breaking Bad TV Series', 'Best series evar', NOW(), 'Uncategorized');
What you're inserting is the string "NOW()"
which is completely different from the function call NOW()
.
As "NOW()"
is not a valid date, it goes in as zero.
Removing the quotes from that should fix the issue.
You shouldn't have to quote the NOW() function, so try without the ' ' and see if that helps.
INSERT INTO blog_details(title, blog_content, blog_date, cat_name)
VALUES('Breaking Bad TV Series', 'Best series evar', NOW(), 'Uncategorized');