Use your code to do this with. Create the table as listed, then on your app have your insert code reflect...
$query = "insert into all_articles values (null,now(),now(),'$text')"; and update the table as listed ... $updateQuery = "update all_articles set updateddate=now(),article='$text' where id=$id"; just adjust your app's syntax as needed. But this should get your result. Larry -----Original Message----- From: Matthew Stuart [mailto:[EMAIL PROTECTED] Sent: Monday, January 05, 2004 7:49 AM To: MySQL email support Subject: struggling newbie - datetime or timestamp problem I have been sent a url for datetime explanations in the MySQL manual. I have learnt a few things, but I am also more confused than ever. I am trying to create a couple of columns (one createddate and one updateddate) in a MySQL table that are DATETIME or TIMESTAMP values, but I am having trouble understanding how it works. I want both columns to auto add a date and time when a record is first inserted, but only the updateddate column to update when the record is updated. Could someone give me the code for these two columns please? This is what I have: CREATE TABLE all_articles ( id SMALLINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, createddate DATETIME DEFAULT "0000-00-00 00:00:00" updateddate DATETIME DEFAULT "0000-00-00 00:00:00" article TEXT ); Obviously these aren't going to auto add/update because I am not stating a NOW() or NULL value anywhere, but I thought this would be the cleanest way to give it to you. The way the zeros, hyphens and colons are typed is how I would like to store my dates if at all possible. TIA Mat -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]