title: PHP code does not update database, no sql error and my IDE is returning no errors, however the database is not updating
body: <p>I'm sorry to ask such a narrow question, but I have this code in PHP and it is supposed to update a user's account.  There is no error being returned and my IDE cannot identify the problem either. The problem is now that the code is not updating the database.  I hope I can get some help on the subject.</p>
  
  <p>Here is my PHP code:</p>
  
  <pre><code>&lt;?php
  
      session_start();
  
      $con = mysqli_connect("mysql.serversfree.com", "u190182631_embo", "17011998embo", "u190182631_login");
  
      $username = $_POST['user_name']; 
      $last = $_POST['lname'];
      $first = $_POST['fname'];
      $address = $_POST['address'];
      $email = $_POST['email'];
      $year = $_POST['year'];
  
      if ($_SERVER["REQUEST_METHOD"] == "POST") {
          if (mysqli_connect_errno()) {
              echo "Failed to connect to MySQL: " . mysqli_connect_error();
          }
  
          mysqli_query($con,"UPDATE users SET last_name = '$last' 
          WHERE user_name = $_SESSION[user_name]");
          mysqli_close($con);
      }   
  ?&gt;
  </code></pre>
  
  <p>Any my HTML form if that is needed:</p>
  
  <pre><code>&lt;form method="post" action="update.php"&gt;
       Username: &lt;input type="text" name="user_name" value="&lt;?php echo $_SESSION['user_name']?&gt;"&gt;&lt;br&gt;&lt;br&gt;
       Email: &lt;input type="text" name="email" value="&lt;?php echo $_SESSION['user_email']?&gt;"&gt;&lt;br&gt;&lt;br&gt;
       Last Name: &lt;input type="text" name="lname" value="&lt;?php echo $_SESSION['last_name']?&gt;"&gt;&lt;br&gt;&lt;br&gt;
       First Name: &lt;input type="text" name="fname" value="&lt;?php echo $_SESSION['first_name']?&gt;"&gt;&lt;br&gt;&lt;br&gt;
       Street Address: &lt;input type="text" name="address" value="&lt;?php echo $_SESSION['address']?&gt;"&gt;&lt;br&gt;&lt;br&gt;
       Year Graduated: &lt;input type="text" name="year" value="&lt;?php echo $_SESSION['year']?&gt;"&gt;&lt;br&gt;&lt;br&gt;
       &lt;input type="submit" value="Update Information"&gt;&lt;br&gt;
   &lt;/form&gt;
   &lt;form method="link" action="manage.php"&gt;
           &lt;input type = "submit" value = "Cancel"&gt;&lt;br&gt; 
   &lt;/form&gt;
  </code></pre>
  
  <p>Any help would be great!</p>