Adding Timestamp to Database Table

samboy01

New Member
I have an html/php form that updates entries on the database server. I need to add a field to each row indicating when that entry is added, so in other words a timestamp of when the entry was created. I have been searching and found this: http://www.createafreewebsite.net/phpmysql/alter.htmlWould I do something like:\[code\]$timestamp = time();mysql_query("ALTER TABLE notificationADD timestamp CHAR(30) AFTER names);mysql_query("INSERT INTO notification (`timestamp`) values ('$timestamp');\[/code\]is this the correct way to approach it, and am I using the correct datatype? I would need to compare the timestamp with another timestamp generated from a javascript file later on. For example, if timestamp1 is smaller than timestamp2 than perform following functions...Any information would be helpful, thanks!EDIT:provided information as requested: So far I have:\[code\]mysql_query("INSERT INTO notification (`program`, `month`, `day`, `year`, `sponsor`, `type`, `category`, `range`, `desc`) values ('$pName' , '$month' , '$day' , '$year' , '$sponsor' , '$type' , '$category' , '$range' , '$desc')");\[/code\]
 
Top