Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to add friends with php

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article introduces the knowledge of "how to add friends with php". Many people will encounter this dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Php to achieve the function of adding friends: 1, the friend application is stored in the application data table; 2, query the application form; 3, to delete friends; 4, to create a group name field; 5, query and list data table information.

This article operating environment: Windows7 system, PHP7.1 version, DELL G3 computer

How to add friends with php?

Php realizes the function of adding friends

Train of thought:

1. After sending a friend application, the user stores the application in the application data table with an unverified status.

2. When the user logs in, query whether there is any uid in the application form that has the same id as the applicant. If you agree, change the status and insert the data into the corresponding friend data table. Otherwise, delete the data in the application data table.

3. When one party deletes a friend, delete the deleted person's friend from the deleted person

4. Create a grouping name field and set a good value for the user to choose, or let the user customize it.

5. List data table information when querying

Attached: there are two mysql data sheets

# the above steps are operations on the database, and you can instantiate # friend list mysql_query ("CREATE TABLE `tFriend` (`id` int (11) NOT NULL auto_increment COMMENT 'self-added id', `uid` int (11) NOT NULL COMMENT' user id', `fid` int (11) NOT NULL COMMENT 'friend uid, used, split, can have multiple', PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8 # Application form CREATE TABLE `tshenqing` (`id` int (11) NOT NULL auto_increment COMMENT 'self-added id', `uid` int (11) NOT NULL COMMENT' applied user id userid', `sid`int (11) NOT NULL COMMENT 'friend applicant id', `text`varchar (255) NOT NULL COMMENT' postscript', PRIMARY KEY (`id`) ENGINE=InnoDB DEFAULT CHARSET=utf8; ")

Every time a user requests an operation, the database will be queried or updated.

This is the end of the content of "how to add friends with php". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report