Problems encountered during php Development (problems related to the overall design of a project)

Source: Internet
Author: User
Problems encountered during php development (the overall design of a project): User user1, user2, user3, user4, user5 ..... the operations performed by the users are the same, but the databases accessed during the execution are different (DB1, DB2, DB3, DB4, db5 ......). Problems encountered during php development (the overall design of a project)
User 1, user2, user3, user4, user5...... the user used to perform the same operation, but the number of accesses during execution

Different databases (DB1, DB2, DB3, DB4, db5 ......).
User1 --> access through php --> DB1
User2 --> access through php --> DB2
User3 --> access through php --> DB3
User4 --> access through php --> DB4
User5 --> access through php --> DB5
..................
The above php program is the same program and implements the same functions.
What should I do to implement the above functions?
------ Solution --------------------
You can select different databases based on your needs.
------ Solution --------------------
You are not sure about the number of users. of course, we create 2 arrays in a loop, a radish and a pitfall!

------ Solution --------------------
Reference:
You can select different databases based on your needs.


Simple use of his;

Reference:
You are not sure about the number of users. of course, we create 2 arrays in a loop, a radish and a pitfall!

Efficient and fast, with arrays
------ Solution --------------------
It turns out to be like this ,~~
You can get the user and the database, and then upload the data to the database ~

------ Solution --------------------
If two users access the php program at the same time but access different databases, will there be conflicts?
No.
Didn't I give it to you?
------ Solution --------------------
The following is an example. of course, you can use arrays.
switch($user)
{
        case 'user1':
           mysql_select_db('db1');
           break;
        case 'user2':
           mysql_select_db('db2');
           break;
        .........................
}

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.