Согласно новой информации, приведенной в комментариях, я меняю свой ответ и корректирую код.
Пример кода:
<?php
$serverName = "server"; //serverName\instanceName
$connectionInfo_mssql = array("Database"=>"DB", "UID"=>"username", "PWD"=>"password","CharacterSet"=>"UTF-8");
$conn_mssql = sqlsrv_connect($serverName, $connectionInfo_bi);
$conn_mysql = new mysqli("server", "username", "password", "db");
//SELECT FROM MS SQL DB
$mssql_array = array();
$ms_sql = "SELECT column_names FROM db_table";
$mssql_query = sqlsrv_query($conn_mssql , $ms_sql);
while($row = sqlsrv_fetch_array($mssql_query) {
$mssql_array[] = array('name' => $row['name'],
'adress' => $row['adress']);
}
foreach($mssql_array as $key => $value) {
//SELECT FROM MySQL DB
$my_sql = "SELECT column_names FROM db_table WHERE name = '".$value['name']."' AND adress = '".$value['adress']."'";
$mysql_query = mysqli_query($conn_mysql , $my_sql);
$num_rows = mysqli_num_rows($mysql_query);
if ($num_rows == 0) {
//Insert in MySQL DB
$sql = "INSERT INTO db_table (db_columns) VALUES (variables_from_array)";
$sql_query = mysqli_query($conn_mysql, $sql);
} else {
//There is a record in DB, and maybe you want to update it. If not, then lose this else part.
}
}
echo 'Table Customers from MS SQL DB and table Customers from MySQL DB are now synced!';
?>