View Single Post
Old 11-23-2022, 10:27 AM  
Publisher Bucks
Confirmed User
 
Industry Role:
Join Date: Oct 2018
Location: New Orleans, Louisiana. / Newcastle, England.
Posts: 1,118
Session Name in SQL query?

What is the best way to include
Quote:
<?=$_SESSION['name']?>
into an SQL query please?

I want to do something along these lines (which isnt the correct way apparently lol):

Quote:
$con=mysqli_connect("localhost","USER","PASS","DB" );

$result = mysqli_query($con,"SELECT * FROM Documents WHERE Writer REGEXP '<?=$_SESSION['name']?>' ORDER BY ID DESC;");

while($row = mysqli_fetch_array($result))
Basically, any time one of my writers logs into the admin system, I want it to display the documents they've completed based on their login name to them and I figured using the session name would be the easiest way, as it gets attached on submission and stored in the DB in the 'Writer' column, I just can't figure out how to get that info to display on a page through an SQL query
__________________
NOTHING TO SEE HERE
Publisher Bucks is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote