title: Compare MySQL row against PHP array values
body: <p>I'm trying to compare IP addresses in a list against a list of blocked IPs.  If the IP address is equal to an address in the $blockedIP array, the row is not included in the list. The list is populated from a mysqli_query.  What I would like to do is exclude the whole row if the IP address matches one in the array.</p>
  
  <pre><code>echo '&lt;div class="genericTable"&gt;&lt;h2&gt;Downloaded Sermons Report&lt;/h2&gt;&lt;table&gt;';
  
  $blockedIP = array('69.58.178.58', '173.199.115.123', '173.199.120.99');
  
  foreach($blockedIP as $ip){
  $sql = mysqli_query($db, "SELECT * FROM dl_log WHERE ipaddress &lt;&gt; '".$ip."'");
  
  while($row = mysqli_fetch_assoc($sql)){
      echo '&lt;tr&gt;';
  
      if($row['ipaddress'] !== $ip){
          foreach($row as $each){
              echo '&lt;td class="genericTable"&gt;'.$each.'&lt;/td&gt;';
          }
      }
      echo '&lt;/tr&gt;';
    }
  }
  echo '&lt;/table&gt;&lt;/div&gt;';
  </code></pre>
  
  <p>I've tried the script a few different ways and either get the whole list or every row &amp; column are compared to the array, which makes for a jacked up looking table.  I'm using the foreach to compare values to the array.  Where should I put it?
  Thanks.</p>