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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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