michaelkirby Posted March 22, 2010 Share Posted March 22, 2010 Hi, I'm new to PHP and still learning how to do things. I have a table which stores all of the users that have registered with the website. One of the tasks is to create a new brief (Adding details from a form) to a brief table. From the user logged in I want to be able to write to the brief table showing the user Id of the person who created the brief. When I'am writing the query to store brief details do I just some how use the session variable to add the User Id?? Anyone able to help me out?? Quote Link to comment Share on other sites More sharing options...
slurpee Posted March 22, 2010 Share Posted March 22, 2010 When I'am writing the query to store brief details do I just some how use the session variable to add the User Id?? Yep, when the user logs in you will want to set some session variable that holds their user id. You can do something like this: session_start(); $_SESSION[sUserID] = $userid; Make sure the session_start() function is called on every page you access the session variables. Also, using the code above you'll have to ensure there is some value in the $userid variable. You can read more about PHP's sessions at: http://php.net/manual/en/function.session-start.php Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.