This question already has an answer here:
In a login system, we are using a table to store login details of students. Columns are : StudentID (int, Auto Increment, Primary Key) StudentName (Varchar, 50) and StudentPassword (Varchar, 16). When the Student logins, we are getting session variable : $_SESSION['Username']. Now, since we are using the StudentID as primary key, it is used to link other tables in the database, we need to store / Get the StudentID as session variable. How to get this extra column as server variable?
</div>