Category Archives: MySQL

How To Assign The Current Date and Time to a MySQL Datetime Field using PHP

By | February 18, 2010

This is a no-brainer, but I always forget how to do it. MySQL datetime fields are stored in this format: 2010-02-18 10:33:18. Here’s a trivial example showing you how to populate a datetime field with the current date in the correct format, then write it to a table: Another question might be: “Why?” – when… Read More »

Forays into PHP and MySQL

By | April 19, 2007

I’ve just started working extensively with PHP and MySQL.  Here’s a simple tip that took me a while to figure out (despite copious examples on PHP.net, I couldn’t find this one: My MySQL table has a  Timestamp (Z) field, used to assign the current date and time to it when a record is added. Using… Read More »