I have the following table in the database:
idUser - Username - Group
1 - John - 5GR
2 - Doe - 1GR
And the following query:
SELECT * FROM 'table' WHERE 'idUser' = '$name' OR 'Group = '$name'
$ name is the variable that contains the value that the user enters.
When the user enters 1, only the user with idUser = 1 is displayed. This is correct.
When the user enters 2, only the user with idUser = 2 is displayed. This is also correct.
The problem is when the user enters '1GR'.
The correct would be to display only the user with Group = 1GR, in this case the user Doe.
However the user John is also presented because his idUser = 1 and the string entered by the user contains 1. The problem is of the comparison with the idUser, I will check if removing this comparison of the query it presents correctly (however the user can no longer search for id user and this is essential).
Is there any way to arrange this?