oscar123 Posted May 2, 2006 Share Posted May 2, 2006 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! Quote Link to comment Share on other sites More sharing options...
bbaker Posted May 2, 2006 Share Posted May 2, 2006 you have to set the $username variable:$username = $_SESSION['username']; Quote Link to comment Share on other sites More sharing options...
oscar123 Posted May 2, 2006 Author Share Posted May 2, 2006 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] Quote Link to comment Share on other sites More sharing options...
ansarka Posted May 3, 2006 Share Posted May 3, 2006 [!--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 valuesIf the globalvaraible in turned on in php config file you can directly use the session variable Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.