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
https://forums.phpfreaks.com/topic/196101-insert-statements/
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
https://forums.phpfreaks.com/topic/196101-insert-statements/#findComment-1029904
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.