Php: 1. after a user sends a friend application, the application is stored in the application data table in the status of & nbsp; not verified. 2 & nbsp; when the user logs on, check whether the uid in the application form is the same as the id of the respondent. if you agree, change the status and insert the data to the corresponding friend data table. otherwise, delete data 3 in the application data table, when one party deletes a friend, it deletes php from the deleted person to add a friend.
Ideas:
1. after a user sends a friend application, the application is stored in the application data table and the status is not verified.
2. when a user logs on, check whether the uid in the application form is the same as the id of the respondent. if you agree, change the status and insert the data to the corresponding friend data table. otherwise, delete data from the application data table
3. when one party deletes a friend, the deleted friend is deleted from the deleted person.
4. create a group name field. set the value of the field to allow the user to select or customize the field.
5. list data table information during query
Appendix: two mysql data tables
# The above steps are for database operations. you canclass="inner-link decor-unline"href="/Search? Word = instantiation & fr = qb_search_exp & ie = gbk"target="_blank"rel="nofollow" data-word="2"> Instantiation,# Friend tableclass="inner-link decor-unline"href="/search?word=mysql_query&fr=qb_search_exp&ie=gbk"target="_blank"rel="nofollow" data-word="0">mysql_query("CREATE TABLE `t_friend` ( `id` int(11) NOT NULL auto_increment COMMENT 'Auto-increment ID', `uid` int(11) NOT NULL COMMENT 'User ID', `fid` int(11) NOT NULL COMMENT 'Friends uid, separated by, can have multiple', PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;# Application FormCREATE TABLE `t_shenqing` ( `id` int(11) NOT NULL auto_increment COMMENT 'Auto-increment 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;"); |
Each user request operation queries or updates the database,
-
Shooow, 1st floor, the day before yesterday
-
The implementation method is good.