I am using PDO (mysql) to create 2 different database connections. I want to transfer a row of data from 1 table to another in a different database. This is not a duplication of the row, only certain rows are selected.
I am unable to get it to work, any ideas?
private function moveCallToProduction() {
try {
$sql = "SELECT * FROM `calls` WHERE `id`=':id'";
$query = $this->staging->prepare($sql);
$query->execute($array);
$results = $query->fetchAll(PDO::FETCH_ASSOC);
try {
$sql = "INSERT INTO `calls` (`id`,`sip_id`,`extension`,`caller_id`,`stage`,`status`,`survey_id`,`start`,`answer`,`hangup`,`end`) VALUES ('?','?','?','?','?','?','?','?','?','?','?')";
$query = $this->production->prepare($sql);
$query->execute($results);
}
catch(PDOException $e) {
$this->informer("FATAL","There was a problem");
}
}
catch(PDOException $e) {
$this->informer("FATAL","We're unable to transport the call from the staging to production server. Error: ".$e->getMessage());
}
}