Jump to content

PHP Session


oscar123

Recommended Posts

How do I filter results from a database based on which user is logged into the site?

I have got the session function working fine with basic user level matching but now want to run queries which check the Session Username with the 'employer' field in the cvs database. When they match I want them to be ommitted from the result.

"SELECT * FROM cvs WHERE employer != '$username'";

Is there another way of doing this? Maybe 'if' statements?

Please help - its driving me nuts!
Link to comment
https://forums.phpfreaks.com/topic/8883-php-session/
Share on other sites

Thanks so much - fantastic - it works!



[!--quoteo(post=370536:date=May 2 2006, 07:58 AM:name=bbaker)--][div class=\'quotetop\']QUOTE(bbaker @ May 2 2006, 07:58 AM) [snapback]370536[/snapback][/div][div class=\'quotemain\'][!--quotec--]
you have to set the $username variable:

$username = $_SESSION['username'];
[/quote]
Link to comment
https://forums.phpfreaks.com/topic/8883-php-session/#findComment-32619
Share on other sites

[!--quoteo(post=370560:date=May 2 2006, 09:42 AM:name=Richie455)--][div class=\'quotetop\']QUOTE(Richie455 @ May 2 2006, 09:42 AM) [snapback]370560[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Thanks so much - fantastic - it works!
[/quote]


in php config file if you turned of global varibles you will have to use $_session['vaiablename']; to get the session registerd variable values

If the globalvaraible in turned on in php config file you can directly use the session variable
Link to comment
https://forums.phpfreaks.com/topic/8883-php-session/#findComment-32909
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.