Forum Moderators: coopster
I have been asked to provide the ability for admins to see when a user logs into my site. In short, I have a login for all members of a certain group. The admin of this group would like the ability to see when and how many people login.
I have two tables that are relevant.
1) Login (fields loginName, date)
2) Member (fields accountName and loginName)
As further detail, here is an example:
GroupA has the following attributes:
In login, loginName = GroupA
In Member, loginName= GroupA and accountName is blank.
AdminGroupA has the following:
In login, loginName = AdminGroupA
In Member, loginName = AdminGroupA and accountName = GroupA
I am trying to write a query that will accomplish the following:
When AdminGroupA logs in, they will have a report that accomplishes the following:
$sql = "SELECT * FROM Login WHERE Login.loginName = Member.accountName" for all instances where GroupA has logged in. (this query, as written, returns all my logins, regardless of permissions. It shows all logins for all admins settings.)
How do I select only those logins where:
Member.loginName = AdminGroupA and Login.loginName = Member.accountName?
I have tried the following, but it does not execute:
$sql = "SELECT * FROM Login
WHERE loginName=Member.accountName AND Member.loginName='{$_SESSION['logname']}'";
Thanks again!