0
我正在使用PDO(mysql)創建2個不同的數據庫連接。我想在一個不同的數據庫中將一行數據從一個錶轉移到另一個表。這不是行的重複,只有特定的行被選中。使用PDO在2個不同的數據庫中重複行
我無法得到它的工作,任何想法?
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());
}
}