Hey All,
I've been wracking my brain on this one for months, and must find a solution soon.
Given the following mysql_connect.php ...
<?php //mysql_connect.php
define ('DB_USER', 'root');
define ('DB_PASSWORD', '');
define ('DB_HOST', 'localhost');
define ('DB_NAME1', 'crm');
define ('DB_NAME2', 'crmx');
$dbc = mysql_connect (DB_HOST, DB_USER, DB_PASSWORD)
or die('Unable to Conntect to Server' . mysql_error());
?>
... called from the following index.php
<?php #APRO Sync STEP 2 - index.php
// Set the page title and include the HTML header.
require_once ('mysql_connect.php'); // Connect to the db.
$message = NULL; // Create an empty new variable.
if ('a') { // If everything's OK.
// Make the query.
$query9 = 'UPDATE crm.notes, crmx.notes'
. ' set crmx.notes.date_modified = crm.notes.date_modified,'
. ' crmx.notes.modified_user_id = crm.notes.modified_user_id,'
. ' crmx.notes.name = crm.notes.name,'
. ' crmx.notes.filename = crm.notes.filename,'
. ' crmx.notes.file_mime_type = crm.notes.file_mime_type,'
. ' crmx.notes.description = crm.notes.description,'
. ' crmx.notes.deleted = crm.notes.deleted'
. ' WHERE crmx.notes.id = crm.notes.id'
. ' AND crmx.notes.date_modified < crm.notes.date_modified';
$result = @mysql_query ($query9)or die ("Query failed - notes"); // Run the query.
$affected_rows = mysql_affected_rows ();
if ($result) { // If it ran OK.
echo 'A - Records Affected: ';
echo $affected_rows;
echo ' - notes<br><br>';
} else { // If it did not run OK.
$message = '<p>notes Update failed due to system error. </p><p>' . mysql_error() . '</p>';
}
} exit(); // Quit the script.
mysql_close(); // Close the database connection.
} else {
$message .= '<p>Please try again.</p>';
}
// End of the main Submit conditional.
// Print the error message if there is one.
if (isset($message)) {
echo '<font color="red">', $message, '</font>';
}
?>
I am able to compare tables on mirror dbs on same server, but how can I alter to compare mirror dbs on two different servers? Something like...
<?php //mysql_connect.php
define ('DB_USER', 'root');
define ('DB_PASSWORD', '');
define ('DB_HOST1', 'my_ip_address');
define ('DB_NAME1', 'crm');
define ('DB_HOST2', 'localhost');
define ('DB_NAME2', 'crmx');
$dbc = mysql_connect (DB_HOST1, DB_HOST2 DB_USER, DB_PASSWORD)
or die('Unable to Conntect to Server' . mysql_error());
?>
which of course... doesn't work! At this point, I'd be thrilled just to get
a connection to the remote host which I thought would be a simple as...
<?php
$dbc = @mysql_connect ('my_ip_address', 'root', '' ) or die ('<p>Could not connect to MySQL because: <b>' . mysql_error() . '</b>');
echo "connection succesful";
?>
which (of course) doesn't work either returning Can't connect Error 10061 so... grrrrrrrr