Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 11-23-2022, 10:27 AM   #1
Publisher Bucks
Confirmed User
 
Industry Role:
Join Date: Oct 2018
Location: New Orleans, Louisiana.
Posts: 733
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
__________________
DMCASUITE
BETA Testers Needed.
Publisher Bucks is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-23-2022, 10:37 AM   #2
k0nr4d
Confirmed User
 
k0nr4d's Avatar
 
Industry Role:
Join Date: Aug 2006
Location: Poland
Posts: 9,199
Exactly the same way as any other variable

$result = mysqli_query($con,"SELECT * FROM Documents WHERE Writer REGEXP '".mysqli_real_escape_string($con, $_SESSION['name'])."' ORDER BY ID DESC;");
k0nr4d is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-23-2022, 12:44 PM   #3
Publisher Bucks
Confirmed User
 
Industry Role:
Join Date: Oct 2018
Location: New Orleans, Louisiana.
Posts: 733
Quote:
Originally Posted by k0nr4d View Post
Exactly the same way as any other variable

$result = mysqli_query($con,"SELECT * FROM Documents WHERE Writer REGEXP '".mysqli_real_escape_string($con, $_SESSION['name'])."' ORDER BY ID DESC;");
Ah okay, I was using the same as in my HTML code, thanks for clearing that up for me man
__________________
DMCASUITE
BETA Testers Needed.
Publisher Bucks is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks

Tags
sql, query, session, writer, documents, display, completed, easiest, figured, login, based, column, info, page, crap, stored, submission, attached, system, figure, basically, lines, correct, lol, apparently



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.