title: Using variables on stored procedures in MySQL
body: <p>I'm trying to make this stored procedure work; I'm trying to receive a parameter and with that look for a row in 'participantes' table, counting the result to validate if the id exists in the table. Somehow when I try to save the procedure it fails sayin "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 16". Any help will be appreciatted.</p>
  
  <pre><code>BEGIN
  DECLARE cuentaAtleta INT;
  
  SELECT COUNT(*)
  INTO cuentaAtleta 
  FROM participantes
  WHERE id_participante =  id; /* id is a parameter */
  
  IF cuentaAtleta &gt; 0 THEN
      SELECT *
      FROM participantes
      INNER JOIN disciplinas ON participantes.id_disciplina = disciplinas.id_disciplina
      WHERE id_participante =  'id;
  
  END IF
  END
  </code></pre>
  
  <p>It's on a Linux Server <br>
  MySQL Version: 5.1.68-cll <br>
  PHP Version: 5.3.16</p>