title: Update MySQL table from PHP table
body: <p>This is only my second project so very new so excuse my scrappy code. 
  I’m trying to generate a table from MySQL with an additional input column. This column is where I want to be able to input a number which will be added to the original MySQL table ‘score’ if that makes sense. The table is DROPPED and CREATED every time a new game starts (not hand) due to different players participating. The inputs for each hand could happen up to 50 times before the table is dropped.
  See the code might make more sense or not. Should be simple I just can’t get my head round it at the moment. </p>
  
  <pre><code>&lt;?php // defined variables to remove errors
  $submit = 'add_scores';
  $name = $message = "";
  $hand = 0;
  $array = $index = "";
  $datatable = "cards_players"; // MySQL table name
  ?&gt;
  
  &lt;?php 
  if (isset($_POST[$submit])) {
  //this is where my insert statement will go 
  }
  
  ?&gt;
     &lt;form method="post" action="&lt;?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?&gt;" class="formAcc"&gt;
      &lt;ul style= "text-align: center"&gt;
  
      &lt;article&gt;
          &lt;li&gt;
              &lt;label&gt;Current Standing&lt;/label&gt;
  &lt;?php   
  $datatable = "cards_data"; // MySQL table name
  
  $sql = "SELECT * FROM ".$datatable." WHERE player IS not NULL ORDER BY id ASC";
  $rs_result = $connection-&gt;query($sql);
  
  // Check connection
  if ($connection-&gt;connect_error) {
      die("Connection failed: " . $connection-&gt;connect_error);
  }            
  ?&gt;
  
  &lt;?php
    echo '&lt;table id="db_results"&gt;
    &lt;colgroup&gt;
      &lt;col class="col15" /&gt;
      &lt;col class="col15" /&gt;
      &lt;col class="col15" /&gt;
      &lt;col class="col20" /&gt;
    &lt;/colgroup&gt;
  &lt;tr&gt;
  &lt;th&gt;Name&lt;/th&gt;
  &lt;th&gt;Previous Score&lt;/th&gt;
  &lt;th&gt;Current Score&lt;/th&gt;
  &lt;th&gt;This Hand&lt;/th&gt;
  &lt;/tr&gt;';
  
  while($row = $rs_result-&gt;fetch_assoc()) {
      echo "&lt;tr class=\"center\"&gt;
          &lt;td&gt;". $row["player"] . "&lt;/td&gt;
          &lt;td&gt;". $row["previous_score"] . "&lt;/td&gt;
          &lt;td&gt;". $row["score"] . "&lt;/td&gt;
          &lt;td&gt;"//. retain_fill ('text','hand','',$hand,'0') ."
          . '&lt;input type="text" name="'.$row["player"].'" placeholder="';
              if (!empty($hand)) {echo $hand. '" value="'.$hand.'"/&gt;';
          }
              else {echo 0 . '" value=""/&gt;';}
          "&lt;/td&gt;
          &lt;/tr&gt;"; 
      }
  echo "&lt;/table&gt;";            
  ?&gt;            
      &lt;/li&gt;
      &lt;li&gt;
          &lt;input type="submit" name="&lt;?php echo $submit?&gt;" value="Input Scores" style="margin-top: 5px;"/&gt;
  </code></pre>
  
  <p>At the moment I'm not even sure how to begin the insert statement for each user as I know this will be a loop of some sort. Any help appreciated :-) </p>