Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

$sqlQuery = "SELECT username as display_name, fullname as full_name, email as email, role as administrators, status as be_on FROM admin";

record role:0,1,...

I want the role of the administrators will display 1 is admin and if equal to 0 , then show the user.

Who can help me?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
132 views
Welcome To Ask or Share your Answers For Others

1 Answer

I think your look for the IF statement

SELECT IF(`admin`.`role`= 1,TRUE,FALSE) FROM ...

http://www.mysqltutorial.org/mysql-if-function.aspx


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...