title: Insert dynamically MySQL-PHP combination
body: <p>I have a custom html page which posts to php variables which then fills out custom sql queries.</p>
  
  <pre><code>function load_table($db, $old_table, $startRow, $nameColumn, $ipColumn, $addressColumn, $cityColumn, $stateColumn, $zipColumn, $countryColumn)
  {
  $select = "SELECT $nameColumn, $ipColumn, $addressColumn, $cityColumn, $stateColumn, $zipColumn, $countryColumn FROM " .$old_table.";";
  $q = mysqli_query($db, $select);
  
  return $q;
  }
  </code></pre>
  
  <p>It works perfectly when all the variables are holding a value, but I need a way to dynamically assert this query, so that if the user is missing a column, i.e zip code is not in their table, it will still run without ruining the query. </p>