从数据库中选择用户


select users from database

$rs=mysql_query("select user.userName,usertype.userType from user,usertype where user.userTypeId=usertype.userTypeId");

此查询获取具有类型的用户,有 2 种类型(用户和管理员(。所以我只需要看到简单的用户而不是管理员。如何解决?数字 1 是管理员类型,数字 2 是简单用户。

如果没有看到您的架构,这几乎不可能回答,但您可能希望执行以下操作:

select user.userName, usertype.userType
  from user, usertype
  where user.userTypeId = usertype.userTypeId
    and usertype.role = 'user'