title: Adding Timestamp to Database Table
body: <p>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: </p>
  
  <p><a href="http://www.createafreewebsite.net/phpmysql/alter.html" rel="nofollow">http://www.createafreewebsite.net/phpmysql/alter.html</a></p>
  
  <p>Would I do something like:</p>
  
  <pre><code>$timestamp = time();
  mysql_query("ALTER TABLE notification
  ADD timestamp CHAR(30) AFTER names);
  
  mysql_query("INSERT INTO notification (`timestamp`) values ('$timestamp');
  </code></pre>
  
  <p>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...</p>
  
  <p>Any information would be helpful, thanks!</p>
  
  <p>EDIT:</p>
  
  <p>Provided information as requested: </p>
  
  <p>So far I have:</p>
  
  <pre><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></pre>