title: $_SESSION['id'] is null
body: <p>I am trying to update the password in a php script,howerver $_SESSION['id'] is null. This is shown via the var_dump function. Hence I can't update it</p>
  
  <pre><code>&lt;?php
  session_start();
  require "../init.php";
  ini_set('display_errors', 1);
  
  
  if(isset($_POST['update'])){
      $password = $_POST['user_pass'];
      $passwordEncrypted = sha1($user_pass); 
  
      $confpassword = $_POST['confirm_pass'];
      $confPasswordEncrypted = sha1($confirmPass);  
      if($password !== $confpassword){
         echo "Passwords don't match!";
      }else{
          $select_query = "SELECT id FROM user_info";
          $run_select_query = mysqli_query($con,$select_query); 
          while ($row_post=mysqli_fetch_array($run_select_query)){
  
              $_SESSION['id'] = $row['id'];
              $user_id = $_SESSION['id'];
              var_dump($user_id);
  
          }
  
          $update_posts = "UPDATE user_info SET user_pass='$passwordEncrypted',confirm_pass ='$confPasswordEncrypted' WHERE id='$user_id'";  
          $run_update = mysqli_query($con,$update_posts); 
          echo "&lt;script&gt;alert('Post Has been Updated!')&lt;/script&gt;";
      }
  
  }
  ?&gt;
  </code></pre>
  
  <p>Any ideas? Thanks.</p>