Foreach Loop and If Statement
<p>I have this foreach statement that is supposed to cycle through an array, but instead of outputting:</p>

<p>[checkbox] Something Here</p>

<p>It will instead output this:</p>

<p>[checkbox] [checkbox] Something here</p>

<p>Basically, the if statement isn't being skipped over, but the foreach loop is looking at the values in my array (in this case I only have 2 for testing purposes) and processing them at the same time instead of separately.  I've done some echo tests and that is what is happening, but why?</p>

<p>$blogID will have array values 56,57 so because the loop is processing both values at the same time, then both options in the if statement become true because 56 equals 56, but then 56 doesn't equal 57 on its 2nd pass so it will process the 2nd half of the if statement as true.  This is weird and I've never had this happen before.</p>

<p>Here is the code:</p>

<pre><code>$getblog = mysql_query("SELECT * FROM content WHERE blogID = '{$_REQUEST['id']}' AND type = '5' ORDER BY `order` ASC");
while ($row = mysql_fetch_assoc($getblog)){
$blogID = $row['id'];    
$tempData[$blogID][] = $row;

$data = $_REQUEST['blogIDS'];
$ids = explode(",", $data);

foreach($ids as $blogIDS) {
    $getblogids = mysql_query("SELECT * FROM content WHERE id = '$blogIDS' AND type = '5' ORDER BY `order` ASC");
    while ($row2 = mysql_fetch_assoc($getblogids)){
        $blogIDS = $row2['id'];    
        $tempData2[$blogIDS][] = $row2;
    }
}
    if ($row['id'] == $blogIDS) {
            echo "&lt;input type='checkbox' name='ids[]' value='{$row['id']}' checked='yes'/&gt;\n";
    } else {
            echo "&lt;input type='checkbox' name='ids[]' value='{$row['id']}'/&gt;\n";
    }

    echo "&lt;a class='heriyah_text1' href='manage_blogposts_add.php?resize=1&amp;edit=1&amp;id={$row['id']}&amp;blogID={$_REQUEST['id']}&amp;pageID={$_REQUEST['pageID']}&amp;div={$_REQUEST['div']}'&gt;{$row['title']}&lt;/a&gt;&lt;p&gt;&lt;/p&gt;\n";
}
</code></pre>
