Hi All,
I am making a kind of dating site. Users can add friends and here i have a problem.
When the user types a letter of the name they are searching for in the input box. There is a request made to my php file that returns 6 users that contain the letters of the user input.
I use this query to search for users:
Code:
select id_user, username from users where username like '%".mysql_real_escape_string($find_user_name)."%' LIMIT 6
The problem is that the users that are already friends also are returned.
My database:
Table users: id_user, user_name, email, ..., ....
Table friends: users_id_user, friend_id
I thought about making a view of users and then removing the ids that are in my friend_id and then use the view to search for new friends. Is there a better way of doing this?
Thanks in advance!
Nick