MySQL after update, update datetime column of same table
<p>I have a table called <code>teamMembers</code>, this table stores a name and an e-mail address of a person:</p>

<pre><code>id       INT (UNIQUE, AUTOINCREMENT)
name     VARCHAR(255)
email    VARCHAR(255)
updated  DATETIME
created  TIMESTAMP
</code></pre>

<p>I've created my trigger using <code>phpMyAdmin</code> and it looks like this in this export:</p>

<pre><code>CREATE TRIGGER teamMembers.updated_updater 
AFTER UPDATE ON teamMembers
    FOR EACH ROW 
        BEGIN
            UPDATE teamMembers SET updated = NOW() WHERE id = OLD.id;
        END
</code></pre>

<p>So when I use a query like this:
<code>UPDATE teamMembers SET name = 'test' WHERE id = 1</code>
I should set the updated column to the current datetime.</p>

<p>This is not working though, I get this error message:</p>

<blockquote>
  <p>#1442 - Can't update table 'teamMembers' in stored function/trigger because it is already used by statement which invoked this stored
  function/trigger.</p>
</blockquote>

<p>I cant really figure out what the problem is here. I think it's because this trigger would invoke itself as well and would therefore become an endless loop.
I think there must be a way to auto-update a record that has just been updated without altering my query.</p>

<p>Could someone help me to use a MySQL trigger to update to <code>updated</code> column?</p>