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.
echo '<div class="genericTable"><h2>Downloaded Sermons Report</h2><table>';
$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 <> '".$ip."'");
while($row = mysqli_fetch_assoc($sql)){
echo '<tr>';
if($row['ipaddress'] !== $ip){
foreach($row as $each){
echo '<td class="genericTable">'.$each.'</td>';
}
}
echo '</tr>';
}
}
echo '</table></div>';
I've tried the script a few different ways and either get the whole list or every row & 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.