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

藏色散人
Release: 2021-07-06 13:46:34
forward
2084 people have browsed it

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!

Related labels:
php
source:segmentfault.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template