PHP Date always returns 0
Please support our PHP advertiser: Free Online Load Test - How many visitors can your web site handle?
Thread Solved
![]() |
•
•
Posts: 6
Reputation:
Solved Threads: 0
I am trying to insert a date into a mysql table field using
but when I open up mysql and run SELECT * FROM table; it returns a date value of 0000-00-00 instead of the current date at time of insert. Am I misunderstanding something with the php date function?
<?php
$date=date(Y-m-d);
mysql_query("INSERT INTO table VALUES('$date')");
?>but when I open up mysql and run SELECT * FROM table; it returns a date value of 0000-00-00 instead of the current date at time of insert. Am I misunderstanding something with the php date function?
![]() |
Similar Threads
Other Threads in the PHP Forum
- csv, convert date, mysql, php (PHP)
- php mysql question (PHP)
- Php (PHP)
- New to php and need some help with a guestbook (PHP)
- vBulletin mod_rewrite (PHP)
- This ought to be simple - extra spaces (PHP)
- Logic to Convert Days From 1800 to a Date (Month, Day, Year) (C++)
- Advanced mySQL Querys (PHP)
Other Threads in the PHP Forum
- Previous Thread: Word Press MU
- Next Thread: Php page containing html form to sql database
•
•
•
•
Views: 500 | Replies: 2 | Currently Viewing: 1 (0 members and 1 guests)





Linear Mode