在php显示中选择 [英] Select in php display

查看:72
本文介绍了在php显示中选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

记录角色:0,1,...

record role:0,1,...

我希望管理员的角色将显示1为admin,如果等于0,则显示用户.

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

谁可以帮助我?

推荐答案

我认为您在寻找IF语句

I think your look for the IF statement

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

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

这篇关于在php显示中选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆