This article uses PHP and jQuery to implement the same application of adding groups by dragging friends. The above is all the content in this article. I hope it will help you learn and my examples will be helpful to your social network project. Are you always looking for google pls's friend drag/drop Group function? Google is amazing! I have used PHP and jQuery to implement the same friend drag-and-drop application for grouping. This PHP Tutorial will show you how to implement it. I hope my example will be helpful to your social network project.
The effect is as follows:
A table contains member (User) data, such as member_id and member_image.
CREATE TABLE IF NOT EXISTS `members` (`member_id` int(9) NOT NULL AUTO_INCREMENT,`member_name` varchar(220) NOT NULL,`member_image` text NOT NULL,`dated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,PRIMARY KEY (`member_id`));
User group Groups
CREATE TABLE IF NOT EXISTS `groups` (`group_id` int(9) AUTO_INCREMENT,`group_name` varchar(220),`sort` int(9),`date` timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,PRIMARY KEY (`group_id`),KEY `sort` (`sort`));
Relationship between user groups User_group
The relationship table user_group of the user and user rent table contains the user_id (same as memeber_id), group_id, member_id (), and sort (sort) fields.
CREATE TABLE IF NOT EXISTS `user_group` (`id` int(9) NOT NULL AUTO_INCREMENT,`user_id` int(9) NOT NULL,`group_id` int(9) NOT NULL,`member_id` int(9) NOT NULL,`sort` int(9) NOT NULL,PRIMARY KEY (`id`));
Javascript script
We use drag and drop for two class attributes:. members and. group.