title: Check in PHP if MySQL Column in Table exists
body: <p>I want to migrate the content of a Drupal7 website to another Drupal7 system using the migrate-module.</p>
  
  <p>I have to add and map fields.  The fields of every content type in drupal are stored in a table called <code>field_revision_field_name</code>.  The value of the most fields are in the column <code>field_name_value</code>. But some fields have another structure, so I want to check if the <code>field_name_value</code> column exists.</p>
  
  <p>I am joining tables and adding Fields in a mysql query in a loop. The problem is, that not every table <code>"field_revision_".$typeFields[$i]</code> (alias is <code>$typeFields[$i]."_table"</code>) has a column <code>$typeFields[$i]."_value"</code>:</p>
  
  <pre><code>for ($i=0; $i &lt; sizeof($typeFields); $i++) {
      $query-&gt;join(
          "field_revision_".$typeFields[$i], 
          $typeFields[$i]."_table", 
          "n.nid = ".$typeFields[$i]."_table.entity_id"
      );
      $query-&gt;addField($typeFields[$i]."_table", $typeFields[$i]."_value");       
  }
  </code></pre>
  
  <p>I want to check this before I do the query, something like this:</p>
  
  <pre><code>for ($i=0; $i &lt; sizeof($typeFields); $i++) {
    if($typeFields[$i]."_table" has Column $typeFields[$i]."_value"){
      $query-&gt;join(
          "field_revision_".$typeFields[$i], 
          $typeFields[$i]."_table", 
          "n.nid = ".$typeFields[$i]."_table.entity_id"
      );
      $query-&gt;addField($typeFields[$i]."_table", $typeFields[$i]."_value");
    }       
  }
  </code></pre>