I have a database system developed in mysql and php, with a login system as well, im using sessions,however when a user adds a record I want it to also record the user who added it, im thinking sessions would allow me to do this but im lost interms of how to retrieve the username from the session and add it to a table: example of a simple insert:
INSERT INTO table_name
VALUES (value1, value2, value3)
I want value 3 to be the username from the sessions, I am not sure how much more information you need to help me to solve this, so ask as you see fit
Set
value3 = $_SESSION['username']after the user has logged in and then insert it into the table.Here’s some pseudo code:
Session ID reference: http://php.net/manual/en/function.session-id.php