title: allowing users to edit in the mysql
body: <p>I am having a problem with my code. This code is supposed to display a mysql database and let the user edit it so that their edits register in the mysql table. But for some reason the query is not working and I can't get it so that the user can edit into a mysql table.</p>
  
  <pre><code>&lt;!DOCTYPE HTML&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;&lt;?php echo 'giggity'; ?&gt;&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;?php
  $con = mysqli_connect('localhost', 'root', 'ankith12','Employees');
          if (mysqli_connect_errno())
      {
           echo "Failed to connect to MySQL: " . mysqli_connect_error();
      }
  
          $sql = "select * from Employ";
          $query = mysqli_query($con,$sql);
          echo "&lt;table border ='1' style='height:90%;width:90%; position: absolute; top: 50; bottom:50; left: 0; right: 0;border:1px solid' align = 'center'&gt;
              &lt;tr&gt;
              &lt;th&gt;Employee id&lt;/th&gt;
              &lt;th&gt;Firstname&lt;/th&gt;
              &lt;th&gt;Lastname&lt;/th&gt;
              &lt;th&gt;Meetings Today&lt;/th&gt;
              &lt;th&gt;Sales&lt;/th&gt;
              &lt;th&gt;Comments&lt;/th&gt; 
              &lt;/tr&gt;";
              ?&gt;
              &lt;form method = 'Post'&gt;
              &lt;?php
  $i = 1;
   while( $row = mysqli_fetch_array($query) )
  {
      echo "&lt;tr&gt;&lt;td&gt;". $row['employee_id'] . "&lt;br&gt;&lt;input type ='submit' name = 'Submit_$i' &gt;". "&lt;/td&gt;";
      echo "&lt;td&gt;". $row['Firstname']. "&lt;input type = 'textfield' name = 'first' &gt;"."&lt;/td&gt;";
      echo "&lt;td&gt;". $row['Lastname']."&lt;input type = 'textfield' name = 'second' &gt;" . "&lt;/td&gt;";
      echo "&lt;td&gt;". $row['Meetings']."&lt;input type = 'textfield' name = 'third' &gt;". "&lt;/td&gt;";
      echo "&lt;td&gt;". $row['Sales']."&lt;input type = 'textfield' name = 'fourth' &gt;". "&lt;/td&gt;";
      echo "&lt;td&gt;". $row['Comments']."&lt;input type = 'textfield' name = 'fifth' &gt;". "&lt;/td&gt;&lt;/tr&gt;";
      $i++;
  }
  echo "&lt;/table&gt;";
  ?&gt;
  &lt;br&gt;
  &lt;br&gt; 
  &lt;!-- Submit&lt;br&gt;&lt;input type ='submit' name = 'Submit' &gt; --&gt;
  &lt;/form&gt;
  &lt;?php 
  
  function alert($s){
      echo "&lt;script type = 'text/javascript'&gt;alert(\"$s\");&lt;/script&gt;";
  }
  
  // $i = 1
  $con = mysqli_connect('localhost', 'root', 'ankith12','Employees');
          if (mysqli_connect_errno())
      {
           echo "Failed to connect to MySQL: " . mysqli_connect_error();
      }
  $query = "SELECT employee_id from Employ";
  $qudey = mysqli_query($con,$query);
  $rows= mysqli_fetch_assoc($qudey);
  $dee = 1;
  $easy = 0;
  // $userfirst = $_POST['first'];
  // $userlast =  $_POST['second'];
  // $usermeetings =  $_POST['third'];
  // $usersales =  $_POST['fourth'];
  // $usercomments =  $_POST['fifth'];
  foreach($rows as $i){
      //alert($_POST["Submit_$dee"]);
      if(isset($_POST["Submit_$dee"])) {
      //  alert("true");
          $i = 1;
          $userfirst = $_POST['first'];
          $userlast =  $_POST['second'];
          $usermeetings =  $_POST['third'];
          $usersales =  $_POST['fourth'];
          $usercomments =  $_POST['fifth'];
          alert($userfirst);
          if($userfirst !== ""){
              $QueryA = "UPDATE Employ SET Firstname = $userfirst WHERE employee_id = $i";
              mysqli_query($con,$QueryA);
              alert($QueryA);
          }
          if($userlast !== "")
          {
              $QueryB = "UPDATE Employ SET Lastname = $userlast WHERE employee_id = $i";
              mysqli_query($con,$QueryB);
          }
          if($usermeetings !== "")
          {
              $QueryC = "UPDATE Employ SET Meetings = $usermeetings WHERE employee_id = $i";
              mysqli_query($con,$QueryC);
          }
          if($usersales !== "")
          {
              $QueryD = "UPDATE Employ SET Sales = $usersales WHERE employee_id = $i";
              mysqli_query($con,$QueryD);
          }
          if($usersales !== "")
          {
              $QueryE = "UPDATE Employ SET Comments = $usercomments WHERE employee_id = $i";
              mysqli_query($con,$QueryE);
          }
          //echo 'done';
  }
  //  echo'done';
      $easy++;
      $dee = $dee + 1;
  }
  mysqli_close($con);
  ?&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>