czukoman20 Posted March 11, 2008 Share Posted March 11, 2008 global $database; $q = "SELECT username,userlevel,email,num_clicks,timestamp,realname,phone " ."FROM ".TBL_USERS." ORDER BY userlevel DESC,username"; ok this is what i have right now.. it works but im unsure on this next part. What i would like to do is make this query work so that it excludes any users that has a user level not equal to 5. Where would i do this in the query Quote Link to comment Share on other sites More sharing options...
bob_the _builder Posted March 11, 2008 Share Posted March 11, 2008 Hi, Try WHERE userlevel <> '5' Quote Link to comment Share on other sites More sharing options...
czukoman20 Posted March 11, 2008 Author Share Posted March 11, 2008 ok thanks i will try i will give u feedback in like 5 - 10 min Quote Link to comment Share on other sites More sharing options...
czukoman20 Posted March 11, 2008 Author Share Posted March 11, 2008 well i tried it with $q = "SELECT username,userlevel,email,num_clicks,timestamp,realname,phone " ."FROM ".TBL_USERS." ORDER BY userlevel DESC,username WHERE userlevel <> '5'"; That didn't work, it won't even display anything now Quote Link to comment Share on other sites More sharing options...
wmguk Posted March 11, 2008 Share Posted March 11, 2008 cant you use != ? $q = "SELECT username,userlevel,email,num_clicks,timestamp,realname,phone " ."FROM ".TBL_USERS." ORDER BY userlevel DESC,username WHERE userlevel != '5'"; Quote Link to comment Share on other sites More sharing options...
czukoman20 Posted March 11, 2008 Author Share Posted March 11, 2008 still the same cant display info deal hmm idk anyone else please Quote Link to comment Share on other sites More sharing options...
wmguk Posted March 11, 2008 Share Posted March 11, 2008 daft question, firstly do you have an error message, or is it just not displaying the userlevel != 5 second daft question, do you have users that arent "5" in the database? Quote Link to comment Share on other sites More sharing options...
czukoman20 Posted March 11, 2008 Author Share Posted March 11, 2008 daft question, firstly do you have an error message, or is it just not displaying the userlevel != 5 second daft question, do you have users that arent "5" in the database? No it pops my error that i created for the query which is error cannot display info. and yes i have 1 user with 5 in the database. Quote Link to comment Share on other sites More sharing options...
bob_the _builder Posted March 11, 2008 Share Posted March 11, 2008 Hi, I beleave WHERE comes before ORDER BY .. Quote Link to comment Share on other sites More sharing options...
czukoman20 Posted March 11, 2008 Author Share Posted March 11, 2008 LOL wow ok only one last problem .. i think its miss recieving the command with the != or the <> .. it should be = to 5 but php is wierd.. I'll look around but if u have a quick post for this it would be appreciated thanks Quote Link to comment Share on other sites More sharing options...
bob_the _builder Posted March 11, 2008 Share Posted March 11, 2008 Hi, That query should leave out any records with the userlevel of 5. $q = "SELECT username, userlevel, email, num_clicks ,timestamp ,realname, phone FROM tbl_users WHERE userlevel <> 5 ORDER BY userlevel DESC"; Try the query above and also formatting yer querys something like above, cleaner and easy to read. hth Quote Link to comment Share on other sites More sharing options...
czukoman20 Posted March 11, 2008 Author Share Posted March 11, 2008 Wrong, The query should leave out any of them that arent 5 soo if it was a 6 it would not display ... only the 5's display.. Not sure wat the symbol is tho Quote Link to comment Share on other sites More sharing options...
bob_the _builder Posted March 11, 2008 Share Posted March 11, 2008 Hi, My bad, I thought you wanted to exclude any records = to 5 so you want a simple query then: $q = "SELECT username, userlevel, email, num_clicks ,timestamp ,realname, phone FROM tbl_users WHERE userlevel = 5"; That will return only records where userlevel is equal to 5. hth Quote Link to comment Share on other sites More sharing options...
czukoman20 Posted March 11, 2008 Author Share Posted March 11, 2008 ok thanks its fixed 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.