title: Remove duplicates in Arrays from MYSQL query and then insert into another table
body: <p>I have the code below to query a table which retrieves arrays.  The parameter $idList could have several values and may therefore produce duplicates.  I am only interested in inserting one unique memalertid.</p>
  
  <p>Any advice on how to remove the duplicates would be much appreciated.</p>
  
  <pre><code>$sql = mysql_query("SELECT  memalertid from memlist where listID IN ($idList) AND (emailyes = '1') ");
  while ($info = mysql_fetch_array($sql)){
  $insert_query = "insert into subsalerts (memalertid, idMembers, emailid) VALUES('".$info['memalertid']."','$idMembers','$emailid')";
  $insert_buffer = mysql_query($insert_query);    
  </code></pre>
  
  <p>Thanks very much</p>