title: Same results returned from MySQL - I know why but don't know solution
body: <p>What I am trying to achieve: I am trying to create a filter which students can use to filter tutors on my website by level, gender or subject. To do this I have created check-boxes which when submitted as "ON" or checked a query is run to find tutors that fufill that criteria. I have used a while loop to check which check-boxes have been checked.</p>
  
  <p>What is happening: The query is returning the right results but say a tutor teaches Maths and English then he will be returned to the results div twice. This is because the tutor fulfills both queries and is returned twice. </p>
  
  <p>I don't know how to go about fixing this so thanks in advance and I'd appreciate all help, below is the relevant section of the HTML and PHP coding. </p>
  
  <pre><code>&lt;form action="" method="get" &gt;
    Name: 
      &lt;input type="text" name="tutor_name"&gt;&lt;br&gt;
    Level:
      &lt;input type="checkbox" name="check[]" value="gcse"&gt;GCSE
      &lt;input type="checkbox" name="check[]" value="a_level"&gt;A Level&lt;br&gt;
    Gender:
      &lt;input type="checkbox" name="check[]" value="male"&gt;Male
      &lt;input type="checkbox" name="check[]" value="female"&gt;Female&lt;br&gt;
    Subject:
      &lt;input type="checkbox" name="check[]" value="maths"&gt;Maths
      &lt;input type="checkbox" name="check[]" value="science"&gt;Science
      &lt;input type="checkbox" name="check[]" value="english"&gt;English&lt;br&gt;
    &lt;input type="submit" value="Go!"&gt;
  </code></pre>
  
  <p></p>
  
  <p></p>
  
  <pre><code>&lt;?php
  
  if(!empty($_GET['check'])){
    foreach($_GET['check'] as $check) {
  
    $check = mysql_query("SELECT `tutor_id` FROM `tutors` WHERE $check=1");
  
    while($row = mysql_fetch_array($check)){
      $tutor_data = tutor_data($row['tutor_id'], 'first_name','image','rating','bio','last_name');
  
      echo "&lt;br&gt;&lt;h3&gt; " . $tutor_data['first_name'];
      echo " " . $tutor_data['last_name'];
      echo "&lt;/h3&gt;&lt;br&gt;" . $tutor_data['bio'];
      echo "&lt;br&gt;Rating: " . $tutor_data['rating']. "&lt;br&gt;&lt;br&gt;";
      }
    }
      $number= mysql_num_rows($check);
        echo "&lt;b&gt;$number&lt;/b&gt; results";
  }
  </code></pre>