You need PHP-Script that checks for changes in one table on one row. $ dbArray is an array in which all computational names with databases.
$dbArray[0]="Comp1"; $dbArray[1]="Comp2"; $checkvalue=""; foreach ($dbArray as $value){ $db=mysqli_connect($value,"Username","Password"); mysqli_set_charset($db,"utf8"); mysqli_select_db($db,"DB_NAME"); $sql = "SELECT * FROM TABLE_NAME WHERE id=1"; $result = mysqli_query($db,$sql); while ($row = mysqli_fetch_assoc($result)){ if($row["Rowname"]!=$checkvalue&&$checkvalue!=""){ UpdateData ($value); }else{
And you need the UpdateData function, which changes the data.
function UpdataData ($ComputerChancedData){ }
The function should read data from the computer $ComputerChancedData and write it to all computers that are not $ComputerChancedData .
// function UpdateData // Here have to be the Code which gets the new Value $checkvalue=""; foreach ($dbArray as $value){ if($value!=$ComputerChancedData){ $db=mysqli_connect($value,"Username","Password"); mysqli_set_charset($db,"utf8"); mysqli_select_db($db,"DB_NAME"); $sql = "UPDATE TABLE_NAME SET ROW_NAME='$NEWVALUE' WHERE id=1"; $result = mysqli_query($db,$sql); } }
Since it needs to be reloaded every minute, you need to reload Javascript:
<script> (function(){(setTimeout(function(){window.location.href="servername/seitenname.php";},60000))}); </script>
EDIT: I am using MySqli for this script
EDIT2: All databases must have the same username and password. If not, you need to create a new user with the correct ones.
Paul schmitz
source share