Jump to content

Archived

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

oscar123

PHP Session

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!

Share this post


Link to post
Share on other sites
you have to set the $username variable:

$username = $_SESSION['username'];

Share this post


Link to post
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]

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

×

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.