Home > Blockchain >  My update code updates more than one field?
My update code updates more than one field?

Time:03-26

Strange one this, I have a database set up with these fields:

EmailConfirmID  
EmailToConfirm                              
ConfirmCode         
DateRequested   
DandTConfirmed 

When I run this bit of sql:

UPDATE Emails2Confirm 
SET 
    DandTConfirmed = NOW()
WHERE
    EmailToConfirm = '[email protected]' AND ConfirmCode = 'whatever';

It changes BOTH DateRequested and DandTConfirmed to the current time. No clue why, all advice appreciated!

CodePudding user response:

The definition of the DateRequested column presumably has the ON UPDATE CURRENT_TIMESTAMP, so any time you modify any other column, it will be updated to the current time.

  • Related