Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个脚本,它大部分与一个 mysql 数据库交互。
但是,当调用某个函数时,我现在想做一个if{}and 在true连接到另一个 mysql 数据库并更新表的情况下。在此之后,其他查询将在原始数据库上运行。
if{}
true
这样做的正确和最有效的方法是什么?
不是下面的路吗?
//do something with original db $conn->query(...); ... if (...) { // do someting with another db $another_conn->query(...); ... } $conn->query(...); ...