I\'ve got a table that looks like this:
CREATE TABLE IF NOT EXISTS `Hosts` (
`id` int(128) NOT NULL AUTO_INCREMENT,
`IP` varchar(15) NOT NULL DEFAULT \'\',
`
It might be the case that the update statement doesn't change anything. If the row with Tid = 'SITE001'
already has Backupstatus
set to 'FAIL'
and Backupmsg
set to 'Connection timed out'
(maybe, set by some previous backup attempt), then MySQL will skip this row and therefore won't change the Lastconnection
timestamp.
Also, I see ON UPDATE CURRENT_TIMESTAMP
more like an administrative feature to keep track of data changes. As a programmer, I would add the timestamp update explicitly:
update Hosts
.
set Backupstatus = 'FAIL', Backupmsg = 'Connection timed out', Lastconnection = NOW()
where Tid = 'SITE001'