Hi, I am strictly a beginner working on creating a social network for the simple reasons of learning a lot of vital things that PHP has to offer. I have created a friend request where the person requesting to be friends insert their id into the requested persons frid (friend request id) column. The column is coded to separate values by commas, I want to be able to run a check though to keep users from requesting a friend more than once.
At first I have created a mysql query that selects the values in the frid:
Code: Select all
SELECT frid FROM $table WHERE frid = '$dbid'
The $dbid is the users logged in session id.
I am thinking that there should probably be a while loop and then explode () array that compares the arrayed values while checking them with the requesting persons id to check for duplication. After that its pretty straight forward, running a if and else.