我正在使用 PDO (mysql) 创建 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());
}
}