title: How to update a setup table only through Key => Value
body: <p>I have a settings table built in the following way (I keep here the code short, for simplicity):</p>
  
  <pre><code> ID |   key  |  value  |  category
  -----------------------------------------
  1   |  key_a | value_a |  geolocal
  2   |  key_b | value_b |  geolocal
  3   |  key_c | value_c |  geolocal
  4   |  key_d | value_d |  opengraph
  5   |  key_e | value_e |  opengraph
  </code></pre>
  
  <p>I read this table through a php/html page with the goal, to be able to update the above settings</p>
  
  <pre><code>&lt;?
  require_once $_SERVER['DOCUMENT_ROOT'].'include/setup.php';
  
  if (!empty($_POST['submit']) and $_POST['submit'] == "UPDATE") {
      ...
      ... I EXPLAIN THIS CODE, WHICH SHOULD WORK ONLY WHEN "SUBMIT" IS CLICKED, BELOW.
      ...
  
  }
  
  $query = "SELECT * FROM setup";
  $sth = sql-&gt;prepare($query);
  $sth-&gt;execute;
  
  while($row = $sth-&gt;fetch(PDO::FETCH_ASSOC)){
      ${$row[$param]} = $row[$value];
  ?&gt;
  ...
  ...
  ...
  &lt;div id="tabs-1"&gt;
      &lt;form method="POST"&gt;
          &lt;div class="tab"&gt;
              &lt;p&gt;&lt;label for="key_a"&gt;KEY 1&lt;/label&gt;&lt;input name="key_a" value="&lt;? echo $key_a; ?&gt;" size="50"/&gt;&lt;/p&gt;
              &lt;p&gt;&lt;label for="key_b"&gt;KEY 2&lt;/label&gt;&lt;input name="key_b" value="&lt;? echo $key_b; ?&gt;" size="50"/&gt;&lt;/p&gt;
              &lt;p&gt;&lt;label for="key_c"&gt;KEY 3&lt;/label&gt;&lt;input name="key_c" value="&lt;? echo $key_c; ?&gt;" size="50"/&gt;&lt;/p&gt;
              &lt;p&gt;&lt;label for="key_d"&gt;KEY 4&lt;/label&gt;&lt;input name="key_d" value="&lt;? echo $key_d; ?&gt;" size="50"/&gt;&lt;/p&gt;
          &lt;/div&gt;
          &lt;input type="submit" name="submit" value="UPDATE"&gt;&lt;input type="reset" value="RESET"&gt;
      &lt;/form&gt;
  &lt;/div&gt;
  ...
  ...
  ...
  &lt;?
  } // END While
  ?&gt;
  </code></pre>
  
  <p>key_a, key_b etc are just examples.
  In the reality, are called like:</p>
  
  <pre><code>app_secret
  artist_name
  token_page_access
  etc etc ...
  </code></pre>
  
  <p>Thus, when I update the values, I have to create the following queries for each entry (the code I referred above):</p>
  
  <pre><code>$query="UPDATE setup SET value = $_POST['key_a'] WHERE key = key_a";
  $query="UPDATE setup SET value = $_POST['key_b'] WHERE key = key_b";
  $query="UPDATE setup SET value = $_POST['key_c'] WHERE key = key_c";
  $query="UPDATE setup SET value = $_POST['key_d'] WHERE key = key_d";
  </code></pre>
  
  <p>As I said, I have not only 4 values on this tables, but almost 150.</p>
  
  <p>Is there a way to simplify the UPDATE query, so that the code is simplified and more effective?</p>