title: PHP and MySQL Loop the same QueryString via GET
body: <p>I am trying to do eCommerce filtering on the category page. So far I can get it to work for one colour, but if the user checks more than one colour, I want it to search for the other colour too. </p>
  
  <h1>URL</h1>
  
  <pre><code>//current
  category.php?colourChoice=White
  //more than one
  category.php?colourChoice=White&amp;colourChoice=Ruby+Red
  </code></pre>
  
  <p>I realise I need some sort of form array or an explode?</p>
  
  <h1>MYSQL</h1>
  
  <pre><code>products
  ---
  id      sku     price
  1       p22     45.00
  2       p33     65.00   
  3       p44     70.00
  
  colours
  ---
  id      sku     name
  1       p22     White
  2       p33     Ruby Red    
  3       p44     Black
  </code></pre>
  
  <h1>HTML</h1>
  
  <pre><code>&lt;form action="form.php" method="get"&gt;
      &lt;input type="checkbox" name="colourChoice" value="White"/&gt;
      &lt;input type="checkbox" name="colourChoice" value="Black"/&gt;
      &lt;input type="checkbox" name="colourChoice" value="Ruby Red"/&gt;
      &lt;input type="checkbox" name="colourChoice" value="Orange"/&gt;
      &lt;input type="submit" value="go"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <h1>PHP</h1>
  
  <pre><code>// VARS
  $colourName=mysql_real_escape_string($_GET["colourChoice"]);
  
  // MYSQL
  $checkSQL=mysql_query("
      SELECT * FROM `products`
      INNER JOIN `colours`
      ON `products`.`sku` = `colours`.`sku`
      WHERE (
      name = '".$colourName."'
          OR name LIKE '".$colourName.";%'
          OR name LIKE '%;".$colourName.";%'
          OR name LIKE '%;".$colourName."'
      )
  ");
  
  // SHOW RESULTS
  while($r = mysql_fetch_array($checkSQL)) {
      echo '
          &lt;div class="product"&gt;
              Cost £'.$r['price'].'&lt;br /&gt;
          &lt;/div&gt;
      ';
  }
  </code></pre>