I have two servers on which two different sites with two separate databases are located. However, some data must be shared, so there is a CRON that runs to copy this data from the first site to the second site. These two sites were used to work on the same server, but now we have separated them, so I'm trying to change PHP to be able to handle this.
Here is the code where I am facing the problem:
$sql = "SELECT * FROM site1.events"; $events = mysql_query($sql, $site1db); $sql = "INSERT INTO site2.events SELECT * FROM $events"; $doIt = mysql_query($sql, $site2db);
Now I know that SELECT * FROM site1.events successful, but it cannot insert into the second site, and I do not see any error. I have never written PHP before (this is an inherited task), so if this is something that has been considered before, take the right direction for me.
Note that site2.events truncated before these commands, so comparison is not required.
source share