Problems encountered during PHP development (a project's overall design of related issues)

Source: Internet
Author: User
Problems encountered during PHP development (a project's overall design problem)
There is no user user1,user2,user3,user4,user5 ..... The user is performing the same operation, but the number of accesses during execution

According to the library different (DB1,DB2,DB3,DB4,DB5 ... )。
User1--> access to-->DB1 via PHP
User2--> access to-->DB2 via PHP
User3--> access to-->DB3 via PHP
User4--> access to-->DB4 via PHP
User5--> access to-->DB5 via PHP
..................
The above PHP program is the same program, the implementation of the same function.
What should I do to implement the above features?


------Solution--------------------
Depending on the user to choose a different database on the line.
------Solution--------------------
Your number of users is not sure, that of course the loop did create 2 arrays, a radish a pit, not just oh ke!

------Solution--------------------
Reference:
Choose a different database depending on the user.


Easy to use with him;

Reference:
Your number of users is not sure, that of course the loop did create 2 arrays, a radish a pit, not just oh ke!

Efficient and fast, with arrays
------Solution--------------------
The original is this, ~ ~
Then get the user and DB, and then pass in, not finished

------Solution--------------------
If two users access the PHP program at the same time, but the database access is different, there will be conflicts
No.
I thought it was for you.
------Solution--------------------
Here is an example, and of course you can use arrays as well.
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.