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 Link to comment https://forums.phpfreaks.com/topic/95535-query-issue/ Share on other sites More sharing options...
bob_the _builder Posted March 11, 2008 Share Posted March 11, 2008 Hi, Try WHERE userlevel <> '5' Link to comment https://forums.phpfreaks.com/topic/95535-query-issue/#findComment-489068 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 Link to comment https://forums.phpfreaks.com/topic/95535-query-issue/#findComment-489074 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 Link to comment https://forums.phpfreaks.com/topic/95535-query-issue/#findComment-489115 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'"; Link to comment https://forums.phpfreaks.com/topic/95535-query-issue/#findComment-489117 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 Link to comment https://forums.phpfreaks.com/topic/95535-query-issue/#findComment-489121 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? Link to comment https://forums.phpfreaks.com/topic/95535-query-issue/#findComment-489123 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. Link to comment https://forums.phpfreaks.com/topic/95535-query-issue/#findComment-489126 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 .. Link to comment https://forums.phpfreaks.com/topic/95535-query-issue/#findComment-489127 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 Link to comment https://forums.phpfreaks.com/topic/95535-query-issue/#findComment-489136 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 Link to comment https://forums.phpfreaks.com/topic/95535-query-issue/#findComment-489144 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 Link to comment https://forums.phpfreaks.com/topic/95535-query-issue/#findComment-489151 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 Link to comment https://forums.phpfreaks.com/topic/95535-query-issue/#findComment-489189 Share on other sites More sharing options...
czukoman20 Posted March 11, 2008 Author Share Posted March 11, 2008 ok thanks its fixed Link to comment https://forums.phpfreaks.com/topic/95535-query-issue/#findComment-490030 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.