Jump to content

Query issue


czukoman20

Recommended Posts

   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

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

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

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

Archived

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

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