Question : Add date to column or table.

im pretty new at this so bare with me.

i need a table that adds the current date to a column every time somewone adds data to it. The form i have lets the user put their information in, such as name and phone number. What i want is a date for each person who adds data. Maybe even a date and time.

this is what i have so far

CREATE TABLE contacts (id int(6) NOT NULL auto_increment,first varchar(15) NOT NULL,last varchar(15) NOT NULL,phone varchar(20) NOT NULL,mobile varchar(20) NOT NULL,address varchar(60) NOT NULL,email varchar(30) NOT NULL,problem varchar(100) NOT NULL,PRIMARY KEY (id),UNIQUE id (id),KEY id_2 (id)

Answer : Add date to column or table.

Okay, that's what I'm using, but I wasn't on that machine earlier. I got back to it long enough to check this, and I was remembering incorrectly. I though you could use Now() as a default, but no, you have to use TimeStamp only. Sorry I mislead you.

create table test (name varchar(20),DateColumn timestamp NOT NULL, last varchar(20));

See: http://www.experts-exchange.com/Databases/Mysql/Q_20603623.html
Random Solutions  
 
programming4us programming4us