PHP implements the "plus" friend drag/drop Group effect _ php instance

Source: Internet
Author: User
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:

The sample database contains three tables, that is, the relationship between users and user groups.

User table Members

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.