php实现同时发布,该如何解决
php实现同时发布
我想做一个表单提交功能 把提交的数据同时发布到3个数据库里 请问代码怎么实现呀?
------解决方案--------------------
这是我的笨办法
INSERT INTO TABLE1 (A,B,C) VALUES ($A,$B,$C)
INSERT INTO TABLE2 (A,B,C) VALUES ($A,$B,$C)
INSERT INTO TABLE3 (A,B,C) VALUES ($A,$B,$C)
------解决方案--------------------
有两个方案 1、如果这三个库是三个服务器的话 设置主从同步数据库即可
2、如果是同一个数据库的三个库,不妨做个简单的内部接口,源程序不变 post数据到这个接口去 让这个接口完成数据库的插入工作!
------解决方案--------------------
- SQL code
acquire mutexcon1: START TRANSACTIONcon1: INSERTcon2: START TRANSACTIONcon2: INSERTcon3: START TRANSACTIONcon3: INSERTflag = con1 insert ok && con2 insert ok && con3 insert okif ( flag ) { con1: COMMIT con2: COMMIT con3: COMMIT} else { con1: ROLLBACK con2: ROLLBACK con3: ROLLBACK}release mutex<div class="clear"> </div>

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Solution to docker start failure: 1. Check the running status, and then release the occupied memory through the "echo 3 > /proc/sys/vm/drop_caches" command; 2. Use "$netstat -nltp|grep .. ." command to check whether the port has been occupied. If it is found to be occupied after going online, change it to an available port and restart.

The difference between insertignore, insert and replace instructions already exist or not. Example of insert error. Insertintonames(name,age)values("Xiao Ming", 23); insertignore ignores insertignoreintonames(name, age)values("Xiao Ming", 24); replace Replace and insert replaceintonames(name,age)values("Xiao Ming", 25); table requirements: PrimaryKey, or unique index result: the table id will be automatically incremented. Test code creates table

Use java's StringBuilder.insert() function to insert a string at a specified position. StringBuilder is a class in Java used to handle variable strings. It provides a variety of methods to operate strings. The insert() function is used to insert strings at specified positions. One of the common methods of positionally inserting strings. In this article, we will introduce how to use the insert() function to insert a string at a specified position and give corresponding code examples. insert()

1. Source of the problem When analyzing performance problems, slow queries and binlog slow transactions are commonly used methods. Recently, I was analyzing a slow query and found that it contained a large number of commit statements that were slow, but the matching could not be completed when analyzing the binlog slow transactions. For example, there may be 1,000 commit statements during this period, but there may be only 100 slow transactions. This is too big a difference, so why does this phenomenon occur? 2. The respective determination methods for slow transactions are usually as follows for an explicitly submitted (insert) transaction: GTID_LOG_EVENT and XID_EVENT are the time when the command ‘COMMIT’ is initiated.

In today's era of web development, effective and efficient table management has become very important, especially when dealing with data-heavy web applications. The ability to dynamically add, edit, and delete rows from a table can significantly enhance the user experience and make applications more interactive. An effective way to achieve this is to leverage the power of jQuery. jQuery provides many features to help developers perform operations. Table rows A table row is a collection of interrelated data, represented by elements in HTML. It is used to group together cells (represented by elements) in a table. Each element is used to define a row in the table, and for multi-attribute tables, it usually contains one or more elements. Syntax$(selector).append(co

Solution to node start error: 1. Execute "node xx.js" directly in the terminal; 2. Add start startup item "scripts": {"test": "echo \"Error: no test specified\" && exit 1 ","start":"node service.js"}"; 3. Re-execute "npm start".

The basic syntax of the insert statement is "INSERT INTO table name (column 1, column 2, column 3, ...), VALUES (value 1, value 2, value 3, ...);", "table name" is to be inserted The name of the data table. "Column 1", "Column 2", "Column 3", etc. are the names of the columns in the table where data is to be inserted. "Value 1", "Value 2", "Value 3", etc. are the names of the columns to be inserted. data value.

How to undo a commit submitted by git: 1. Modify the content of the last commit. If you find that there is an error in the last commit, you can use the "git commit --amend" command to modify it; 2. Undo the changes of a commit, If you need to completely undo a commit and its corresponding changes, you can use the "git revert" command; 3. If you need to completely roll back to the state before a commit, you can use the "git reset" command.
