title: PHP's lack of unsigned ints and MySQL's CRC32 function
body: <p>I told Sphinx to index some strings in their CRC32 forms as attributes, like so:</p>
  
  <pre><code>sql_query = SELECT [...], CRC32(LOWER(color)) AS color, [...], FROM table
  
  sql_attr_uint = color
  </code></pre>
  
  <p>I'm trying to get some faceted search going in PHP, where users can click on a link with one of the above <code>colors</code> and Sphinx would get another search request going with narrowed down results, something like:</p>
  
  <pre><code>Previous page:
  &lt;h3&gt;Narrow down results:&lt;/h3&gt;
  &lt;p&gt;&lt;a href="search.php?query=something&amp;color=1678454"&gt;Red (11)&lt;/a&gt;&lt;/p&gt;
  &lt;p&gt;&lt;a href="search.php?query=something&amp;color=4133605867"&gt;Yellow (5)&lt;/a&gt;&lt;/p&gt;
  
  &lt;?php
      if (isset($_GET[$name]))
      {
          $sphinx-&gt;SetFilter('color', intval($_GET['color']));  // &lt;-- Uh-oh
      }
  
      [...]
  
      $sphinx-&gt;Query($query, 'table');
  ?&gt;
  </code></pre>
  
  <p>Things goes wrong here because MySQL's CRC32() returns an unsigned 32-bit integer, which PHP very helpfully does not support and caps at 2^31-1. The above link for the color Yellow exposes my problem.</p>
  
  <p>StackOverflow, what may be an acceptable workaround for this? I suppose doing some math on the SQL query side is possible, but I'm wary of making the worrying chance of collision even worse.</p>
  
  <p>Thanks in advance.</p>