PHP merge discuz user script method, php merge discuz script

Source: Internet
Author: User

PHP merge discuz user script method, php merge discuz script

This example describes how to merge discuz user scripts in PHP. Share it with you for your reference. The details are as follows:

A few days ago, I met a project that needs to merge two discuz jobs. One project has a user level of around 0.12 million, and the other is 10 thousand 8. Needless to say, it definitely throws 10 thousand 8, leaving 0.12 million. At first, I felt that it was not easy to handle. Data Tables were all associated. I registered a new user and added records to eight tables. I haven't seen whether other tables have the possibility of modifying records. At that time, I thought that at half past one, I couldn't understand those tables. I searched for them and found the discuz tool. but I can only export less than 0.1 million, so I can only try it myself. Later I thought about how to insert a record directly in the key table, other tables may automatically complete the relevant data during user operations, so they try to export the original 10 thousand users, then I wrote a PHP script to directly write the 10 thousand users to the memeber TABLE OF THE uncenter. The test is OK. Unfortunately, the user points are missing, but the user name and password are retained.

Key steps:

1. Export the uncenter member database of the system to be replaced as an SQL file.
2. Run the script.

Disclaimer: This script only provides ideas. Back up data before using it. Data loss is irrelevant to the author. (Simple code, Do not spray)

Set_time_limit (0); $ link = mysql_connect ('localhost', 'ngjc', 'ohft6yhhyvt5 ') or die ('could not connect :'. mysql_error (); echo 'connected successfully '; mysql_select_db ('ngjc') or die ('could not select database'); require "SQL. php "; // The exported SQL File $ arrayerr = array (); $ oknum = 0; $ errnum = 0; mysql_query (" SET NAMES utf8 "); foreach ($ sqlarr as $ SQL) {if (! Mysql_query ($ SQL) {$ arrayerr [] = $ SQL; $ errnum ++;} else {$ oknum ++;} echo "<pre> OK: $ oknum <br> errornum: $ errnum <br> error: <br> "; print_r ($ arrayerr); mysql_close ($ link );

I hope this article will help you with php programming.

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.