PHP variable question

Posted by Kyle Parisi on Stack Overflow See other posts from Stack Overflow or by Kyle Parisi
Published on 2010-12-24T04:10:22Z Indexed on 2010/12/24 4:54 UTC
Read the original article Hit count: 146

Filed under:
|

This works:

$customerBox = mysql_query("MY SQL STATEMENT HERE");  
$boxRow = mysql_fetch_array($customerBox);  

$customerBox = mysql_query("MY SQL STATEMENT AGAIN");
while($item = mysql_fetch_assoc($customerBox)) {
      foreach ($item as $columnName => $value) {
          if (empty($value)) {
               print $columnName;
          }
      }
}

This does not:

$customerBox = mysql_query("MY SQL STATEMENT HERE");  
$boxRow = mysql_fetch_array($customerBox);  

while($item = mysql_fetch_assoc($customerBox)) {
      foreach ($item as $columnName => $value) {
          if (empty($value)) {
               print $columnName;
          }
      }
}

Why? I guess I don't understand how variables work yet.

© Stack Overflow or respective owner

Related posts about php

Related posts about variables