title: Dynamic Update MySql Table
body: <p>I am attempting  to Dynamically update a MySql table, the <code>$query</code> looks correct when i echo it, but for some reason it dose not work when i insert the code into the MySql Query. </p>
  
  <pre><code>$b = 1;
  $query_a = array();
  $vars = array();
  $result = mysql_query("SELECT * FROM my_table");
  
  for ($i = 0; $i &lt; mysql_num_fields($result); $i++) {
      $vars[] = mysql_field_name($result,$b);
      $b++;
  }
  
  
  
  foreach ($vars as $v)
  {
      if (isset($_GET[$v]))
      {
          $isclean =  $_GET[$v];
          $query[] = $v.' = '.$isclean.'';
      }
  }
  $query = implode(',', $query);
  
  
  mysql_query("UPDATE my_table SET $query WHERE UIN = '1'");
  </code></pre>