Home >PHP Framework >ThinkPHP >ThinkPHP5 assigns the dynamic link library to variables, resulting in the problem of merging multiple SQL data

ThinkPHP5 assigns the dynamic link library to variables, resulting in the problem of merging multiple SQL data

藏色散人
藏色散人forward
2021-07-01 15:17:122116browse

thinkphp tutorial: ThinkPHP5 pays the dynamic link library to variables, resulting in the problem of merging multiple sql data

ThinkPHP5 assigns the dynamic link library to variables, resulting in the problem of merging multiple SQL data

Because it is The configuration file configures multiple database links, so the database must be dynamically linked when executing statements.

ThinkPHP5 assigns the dynamic link library to variables, resulting in the problem of merging multiple SQL data

Because I linked the library once and then paid a variable $db, the data of enterpriseData was not cleared after executing the first insert statement, and then executed the second When inserting the insert statement, TP merged the enterpriseData data into memberData. This resulted in an error being reported when retrieving the insert statement and finding that there were no fields in enterpriseData in the table! ! !

Solution:

Every time the insert statement is executed, a dynamic link library is required, so that the data of the last execution will be cleared.

If you change it to this, there will be no problem.

ThinkPHP5 assigns the dynamic link library to variables, resulting in the problem of merging multiple SQL data


##

The above is the detailed content of ThinkPHP5 assigns the dynamic link library to variables, resulting in the problem of merging multiple SQL data. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:segmentfault.com. If there is any infringement, please contact admin@php.cn delete