Forum Moderators: open
For example John reccomends Fred, In Freds row under 'recusers' his name will be recorded in a format like this:
Fred - person1 - person2 - person3
I've got that working properly but this is what I want to do now. I'm checking the person whos trying to do it against the ones already there so if the query returns a name that is equal to the person that is doing it, it wont let them.
I guess I need to have somthing like:
SELECT recusers FROM users WHERE username='$username'
But I don't know how to just extract the one name I was looking for (which will be $vusername) instead of all the names in the recusers column.
Thanks.
otherwise, you don't need to extract the name - just to know that it exists in the string.
in that case you could try something like:
SELECT COUNT(*) as found FROM users WHERE username LIKE '% - $username%'
(as long as you don't allow hyphens in user names)