title: automatically lock user account in mysql database
body: <p>I want to lock user accounts automatically when user failed to login after 3 attempts with wrong username/password in mysql database.</p>
  
  <p>I tried </p>
  
  <pre><code>CREATE TRIGGER updateTrigger 
  BEFORE UPDATE ON users 
  FOR EACH ROW
  BEGIN IF NEW.is_code=1 AND NEW.times_logged_in&gt;=3
  THEN SET NEW.is_active=0;
  END IF;
  END;
  </code></pre>
  
  <p>but I am getting</p>
  
  <blockquote>
    <p>You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'END' at line 1'</p>
  </blockquote>
  
  <p>Please help me</p>