looping array problem
<p>I have a simplified ajay script, from which I have removed all nonrelevant code. The problem I am having is first with my columns array and the subsequent foreach loop. I want to go through each element and change the corresponding element to YES if true and NO if false, I don't see why it isn't working.</p>

<p>If there are any problems such as syntax errors or braces or such, they are a problem from simplifying my code, and are not present in the version on my machine.</p>

<pre><code>&lt;?php
$con = mysqli_connect("localhost", "", "", "");
if (!$con) {
    echo "Can't connect to MySQL Server. Errorcode: %s\n". mysqli_connect_error();
    exit;
}
$con-&gt;set_charset("utf8");
    $query1 = 'SELECT EGGS, SALAD, TREES, REVISED FROM AUCTIONS WHERE ARTICLE_NO = ?';
    if ($getRecords = $con-&gt;prepare($query1)) {
     $getRecords-&gt;bind_param("s", $pk);
     $getRecords-&gt;execute();
     $getRecords-&gt;bind_result($EGGS, $SALAD, $TREES, $REVISED);
     while ($getRecords-&gt;fetch()) {
     $columns = array('EGGS', 'SALAD', 'TREES', 'REVISED');
      foreach($columns as $column) {
       $$column = $columns[$column] ? 'YES' : 'NO';
      }
      imageSize = imageResize($PIC_URL, 250, 300);
      echo "&lt;h1&gt;".$EGGS."&lt;/h1&gt;";
     }
    }
function imageResize($imageURL, $maxWidth, $maxHeight) {
    $imageSize["width"] = 0;
    $imageSize["height"] = 0;
    $size = getimagesize($imageURL);
    if ($size) {
     $imageWidth  = $size[0];
     $imageHeight = $size[1];
     $wRatio = $imageWidth / $maxWidth;
     $hRatio = $imageHeight / $maxHeight;
     $maxRatio = max($wRatio, $hRatio);
     if ($maxRatio &gt; 1) {
      $imageSize["width"] = $imageWidth / $maxRatio;
      $imageSize["height"] = $imageHeight / $maxRatio;
      return $imageSize;
     } else {
      $imageSize["width"] = $imageWidth;
      $imageSize["height"] = $imageHeight;
      return $imageSize;
     }
    } else {
     die(print_r(error_get_last()));
    }
}
</code></pre>
