title: Syntax error in sql query for laravel
body: <p>I'm looking for the distance around a particular point.</p>
  
  <p>I have these items in my db with a lat and long.</p>
  
  <p>I want to get all the results around it for a specified radius.</p>
  
  <p>This is how i get it:</p>
  
  <pre><code>    $lat = '51,3';
      $long = '4,3';
      $radius = '5';
  
      $hamsters = Hamster::select(
             DB::raw("*,
                           ( 6371 * acos( cos( radians(?) ) *
                             cos( radians( lat ) )
                             * cos( radians( long ) - radians(?)
                             ) + sin( radians(?) ) *
                             sin( radians( lat ) ) )
                           ) AS distance"))
             -&gt;having("distance", "&lt;", "?")
             -&gt;orderBy("distance")
             -&gt;setBindings([$lat, $long, $lat,  $radius])
             -&gt;get();
  </code></pre>
  
  <p>Now it gives me an error:</p>
  
  <blockquote>
    <p>SQLSTATE[42000]: Syntax error or access violation: 1064 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 'long ) -
    radians(?) ) + sin( radians(?) ) * ' at line 4 (SQL: select *, ( 6371
    * acos( cos( radians(51,3) ) * cos( radians( lat ) ) * cos( radians( long ) - radians(4,3) ) + sin( radians(51,3) ) * sin( radians( lat ) )
    ) ) AS distance from <code>hamsters</code> having <code>distance</code> &lt; 5 order by
    <code>distance</code> asc)</p>
  </blockquote>
  
  <p>Anybody a way to fix this?</p>