title: Update or insert into table depending if exists
body: <p>I would like to update a table if the user is already set, if not I would like to insert the data into the table.</p>
  
  <p>Now I am trying to do something with an IF statement, but that doesn't work.
  as you can't start with an IF apperently. </p>
  
  <p>this is what I have so far, maybe someone has an idea how to do this the right way.</p>
  
  <pre><code>IF (SELECT user_id FROM reports WHERE user_id=19) THEN
  BEGIN
      UPDATE reports 
      SET latlng='42.12,4.124', facilities=null, organize=null, expired=null
      WHERE user_id=19
      AND id&lt;&gt;0;
  END;
  ELSE
  BEGIN 
      INSERT INTO reports 
      (user_id, latlng) 
      VALUES (19, '42.12,4.124');
  END;
  END IF;
  </code></pre>
  
  <p>thanks in advance!</p>