Jump to content

Insert statements


michaelkirby

Recommended Posts

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??

 

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.