title: how to use a php loop to update database?
body: <p>I have look all over youtube and forms and I still can't find an answer that works. I want use a php loop to update database values. I need something like the two last loops below. Thanks in advance.</p>
  
  <pre><code>&lt;?php
  
      if (isset($_POST['update'])) {
  
          for ($i = 1; $i &lt;= 6; $i++) {
               $heading[$i] = $_POST['heading' . $i];
          }
  
          for ($i = 1; $i &lt;= 9; $i++) {
               $des[$i] = $_POST['des' . $i];
          }
  
          for ($i = 1; $i &lt;= 6; $i++) {
               $update = mysqli_query($connect, "UPDATE info1 SET heading[$i]='$heading[$i]' WHERE id= $i");
          }
  
          for ($i = 1; $i &lt;= 9; $i++) {
              $update = mysqli_query($connect, "UPDATE info1 SET des[$i]='$des[$i]' WHERE id= $i");
          }
  
          header('Location: admin.php?success');
          exit();
      }
  ?&gt;
  </code></pre>