Updating nested rows I'm trying with this code:

DELIMITER //
CREATE TRIGGER myTrigger AFTER UPDATE ON cityies
FOR EACH ROW
BEGIN
 if NEW.visitors &lt;=&gt; OLD.visitors THEN
set visit_time = now()
END IF;
END;//
DELIMITER ;


I'm getting this error message: 


  unknown system variable visit_time


Note: visit_time has DATETIME type.
There are two problems

PROBLEM #1

The visit_time needs to be prefixed with NEW.

PROBLEM #2

It needs to be a BEFORE UPDATE, not AFTER UPDATE because you cannot change values in an AFTER trigger.

Your code should read

DELIMITER //
CREATE TRIGGER myTrigger BEFORE UPDATE ON cityies
FOR EACH ROW
BEGIN
    IF NEW.visitors &lt;&gt; OLD.visitors THEN
        SET NEW.visit_time = now();
    END IF;
END
//
DELIMITER ;