Friend Request System Using PHP and MYSQL
Facebook site gave its members an easy way to connect with each other
one-on-one based on shared interests and other profile information.So,
this post is tells how you can make your own friend request process
using a simple codes of PHP and Mysql. This project starts with the login & signup process in which you have to first login with your valid email ID or password you can send
request to the particular friend, accept or delete friend request or
even unfriend option are also resides in this project Let's start
Database Design:
In this tutorial there are three tables:1. Signup table
- id int(5)
- email varchar(100)
- username varchar(50)
- photo varchar(150)
- password varchar(25)
2. Request table
- id int(5)
- from varchar(100)
- email varchar(100)
3. My Friend table
- id int(5)
- email varchar(100)
- friend varchar(100)
Send Friend Request :
This
is the first step in which you have to send friend request to the
person and it depends on him wheather he accept or not we will discuss
in next step.
$insert_request =mysql_query("INSERT INTO `wikitrix`.`request`
(`from`, `email`) VALUES ('".$_SESSION['email']."',
'".$_GET['friend_email']."');");
This is a simple insert query which will insert a request to the email field.
Accept or Delete Friend Request :
I think this it is the main portion of this post when it depends to a
that person Wheather he accept request or delete. Accept or delete portion plays a major role in
this project.To complete this portion i will spend about 2-3 hours.I am
just explaing you the little part of this step through queries.You can
download the complete project as a reference.
// Check wheather he send friend request or not if he sends a request then it will show to the user ...So the query is
$check_request=mysql_query("select * from `request` where `from` =
'".$_SESSION['email']."' and `email` = '".$_GET['friend_email']."' OR
`from` = '".$_GET['friend_email']."' AND `email` =
'".$_SESSION['email']."';");
Accept Query
$insert_myfriend
=mysql_query("INSERT INTO `wikitrix`.`myfriend` (`email`, `friend`)
VALUES ('".$_SESSION['email']."', '".$_GET['friend_email']."');");
Delete Query
$delete_request=mysql_query("DELETE FROM `wikitrix`.`request` WHERE `request`.`from` = '".$_GET['friend_email']."' AND `request`.`email` = '".$_SESSION['email']."' ;");Unfriend :
This is the last step in which you see that if a person want to unfriend how he can remove them so there is a simple coding behind this.
$unfriend= mysql_query("DELETE FROM `wikitrix`.`myfriend` WHERE
`myfriend`.`email` = '".$_GET['unfriend_email']."' AND
`myfriend`.`friend` = '".$_SESSION['email']."' ;");
If there is any query related to this topic what will you do ummm.. you can comment.. Enjoy friends..
unable to download source code
ReplyDeletehelp me to download source code
ReplyDeleteunable to download source code....
ReplyDeletegood but can't download source code ;((
ReplyDeletethankssssss
ReplyDeletegood but can't download source code ;((
ReplyDeletedo you have the url to download the files
ReplyDeletedo you have the url to download the files
ReplyDeletecan you please give me source code?
ReplyDeletesorce code plzz
ReplyDeletetienes todo el codigo completo? podrias subirlo en archivo de texto para descargarlo gracias
ReplyDeleteawesome, thanks for the advice. my question is how do you bring out friends accepted
ReplyDelete
DeleteHi Udoh Unyime
You just have to make a table myfriend and when you click on a individual link there email address will store into myfriend table and you have to fetch the details of your friend through that email using select query..
I hope you got it.If there is any query please feel free to ask..
Thanks :)