title: mysql timestamp update using same value in column
body: <p>I have field in MySQL table which i set it to default value as timestamp,when I update it first time it get update to current timestamp and when I update it second time then also it get update to current timestamp bt when I update the same third time with same value in column timestamp field not get update to current timestamp.</p>
  
  <p>My table structure is:</p>
  
  <pre><code>+-----------+-----------+------+-----+-------------------+-----------------------------+
  | Field     | Type      | Null | Key | Default           | Extra                       |
  +-----------+-----------+------+-----+-------------------+-----------------------------+
  | EID       | int(11)   | NO   | PRI | 0                 |                             |
  | MOD_EID   | int(11)   | YES  |     | NULL              |                             |
  | EXIT_TIME | timestamp | NO   |     | CURRENT_TIMESTAMP | on update CURRENT_TIMESTAMP |
  +-----------+-----------+------+-----+-------------------+-----------------------------+
  </code></pre>
  
  <p>when I update first time I am inserting required value in EID and 0 in MOD_EID. When I update second time I am updating MOD_EID with required value. In both cases I able to get current_timestamp in EXIT_TIME.
  But when I update MOD_EID field again with the same value after minute or one day , EXIT_TIME field not getting update to current_timestamp?
  what's wrong</p>
  
  <p>The code for update is</p>
  
  <pre><code>String vexit=request.getParameter("string");
  
  StringTokenizer tok=new StringTokenizer(vexit,"");
  
  String sql,query,query2;
  int count2=0;
  
  
      while(tok.hasMoreTokens())
      {
              String ide=tok.nextToken();
  sql="SELECT count(EID) FROM tm_exit where EID='"+ide+"' ";
              ResultSet rs=st.executeQuery(sql);
              while(rs.next())
              {
              count2=rs.getInt(1);
  }
          if(count2 &gt;0)
              {
  query="UPDATE tm_exit set MOD_EID='"+ide+"' WHERE EID='"+ide+"'";
  int flag=st.executeUpdate(query);
  }
          else
              {
  query2="INSERT INTO tm_exit (EID,MOD_EID)values('"+ide+"',0)";
  int flag2=st.executeUpdate(query2);
  }
      }
  </code></pre>