I am making a dating website where people can see if people have viewed their profile.
To do this I use a query to insert an entry into a two field table - id and viewed_by.
This is the query I use:
mysql_query("INSERT INTO viewed_me (id, viewed_by) VALUES($id, $user_id)");
It works but it is possible for the same user to view another users profile twice therefore on the viewed me page you get two of the same user shown which is not right.
I have had problems using a primary key in the table - it messes it up.
Is there anyway I can add more code to this query, like an if statement to make sure a duplicate entry is not going to be made?
Thanks anyone