title: mysql syntax error, but where?
body: <p>I'm following some tutorials on mysql function creation but I keep getting the following error.</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 '' at line 5:</p>
  </blockquote>
  
  <pre><code> CREATE FUNCTION getstatisticscount (h VARCHAR(35),d date)
    RETURNS INT
    DETERMINISTIC
     BEGIN
      DECLARE tel INT;
      SELECT count(hash) into tel from statsitieken where hash=h and lastvisit between concat(d,' 00:00:00') and concat(d,' 23:59:59') group by hash;  
      RETURN tel;
     END;
  </code></pre>
  
  <p>I can for my life not find where line 5 is, but no matter which line I put it on, I keep getting this error.
  If I remove this function from the sql fiddle code it's all fine.
  I can't find what's wrong with it... except maybe flawed tutorials.</p>
  
  <p><a href="http://sqlfiddle.com/#!2/70f0a" rel="nofollow">http://sqlfiddle.com/#!2/70f0a</a> </p>