title: How to I bind 'id' from mysql query to $_SESSION
body: <p>I am trying to set the $_SESSION to the 'id' in the mysql query. How do I do that?</p>
  
  <pre><code>public function Login($email, $pass){
          if(!empty($email) &amp;&amp; !empty($pass)){
              $st = $this-&gt;db-&gt;prepare("select email, pass, id from login where email=? and pass=?");
              $st-&gt;bindParam(1, $email);
              $st-&gt;bindParam(2, $pass);
              $st-&gt;execute();
  
              if ($st-&gt;rowCount() == 1){
                  //login correctly
                  $_SESSIONS['user_id'] = XXX;
                  header('Location: main.php');
              } else{
  
              echo "Wrong password";
              }
          } else {
              echo "Please enter username and password";
          }
      }
  </code></pre>