I have used a datetime field in my database for storing dates, whats the proper way to insert say todays date into that field using PHP?
Cheers,
Don't use PHP at all, but the database's built-in function for that.
Assuming you're using mySQL, the function's name is NOW().
11.7. Date and Time functions in the mySQL manual
Use the PHP function time() instead and store the value as a normal integer - that gives you much more possibilities.
As everyone else has said, using the MySQL function NOW() would probably be the best bet for a DATETIME column. MySQL also has many date and time functions available.
Personally, I do what Ivarska suggested and use an INT data type with PHP's time() or MySQL's UNIX_TIMESTAMP(). It gives the date in the GMT standard and it will port over easily.
NOW()function (assuming you use MySQL, I'm pretty sure other DBMS' offer the same).