[SOLVED] My update code updates more than one field?

Issue

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!

Solution

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.

Answered By – Barmar

Answer Checked By – Mary Flores (BugsFixing Volunteer)

Leave a Reply

Your email address will not be published.