I have a group feature on my website that allows 1 user to put the userids of any of his or her friends into an invitedusers column. I need to do an SQL search to determine whether the logged-in user’s ID has been stored in any invitedusers columns by his or her friends.
How can I do this with an sql search?
EX: My column is invitedusers, and inside that column is stored the following, (234,394,479)
When Userid 234 has logged in, I need to search to see whether any columns have userid 234 stored inside the invitedusers column.
SELECT userid, name... FROM mytable WHERE invitedusers = ?
*I looked at the SQL IN operator along with FIND_IN_SET but no help with either.*
Assuming that you’re really using
234,394,479as value of one column (you at least should use,234,394,479,to be able to doWHERE invited LIKE '%,234,%'in your query) you should rebuild your user tables, remove fieldinvited_usersand create table like this:And than just select list of users who invited user 234 with query: