Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/56.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 在2台mysql服务器上插入仅更新修改的字段_Php_Mysql - Fatal编程技术网

Php 在2台mysql服务器上插入仅更新修改的字段

Php 在2台mysql服务器上插入仅更新修改的字段,php,mysql,Php,Mysql,我在两个不同的位置上有两台sql Server 一个是web服务器,另一个是crm系统 人们在网上进行更新和注册,当他们进行更改时,我需要将更改插入或更新到我的crm服务器 我在web服务器上有一个视图,可以从中进行选择,但我需要 insert into on duplicate update only fields that changed and then in a description show wich fields were updated? 我不知道如何开始。也许是这

我在两个不同的位置上有两台sql Server

一个是web服务器,另一个是crm系统

人们在网上进行更新和注册,当他们进行更改时,我需要将更改插入或更新到我的crm服务器

我在web服务器上有一个视图,可以从中进行选择,但我需要

insert into on duplicate update only fields that changed and then in a description 
show     
wich fields were updated?

我不知道如何开始。

也许是这样的

在重复的更新表上插入表集合字段=值,其中字段!='价值'
您可能希望查看是否存在差异。

更改字段后,无法确定字段之间的差异

但是,您可以在更新之前选择并存储内容,然后将其与新内容进行比较

然后问题就变成了:您需要每列的差异吗

  • 如果是:预先选择并自己进行更改(在 应用程序)
  • 如果否:使用@Ogelami描述的方法(并接受他的答案:)
另一方面:当您开始使用多个mysql服务器时,预选功能将无法正常工作,因为您可能会遇到数据漂移的问题(即一台服务器插入的数据落后)。当这种情况发生时,该方法将变得更加复杂