复制MySQL中第二个数据库中第一个数据库的一列

i change all of one column of database by mistake with update command (about 18000 record)

i have backup , so reastore it to another database name

all of thing i want is copy one column of backup database to that coulmn of master database (update ) so i write this code in php :

ini_set('max_execution_time', 3000000000000000000000000000000000000000000);
error_reporting(E_ALL);
ini_set('display_errors', 1);

function connection1()
{
    $DBName1 = "db1";
    $DBUser1 = "user1";
    $DBPassword1 = "pass1";
    $DBHost1 = "localhost";


    try {
        $pdo = new PDO("mysql:host=" . $DBHost1 . ";dbname=" . $DBName1 .
            ";charset=utf8", $DBUser1, $DBPassword1, array(
            PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'utf8'",
            PDO::ERRMODE_EXCEPTION,
            PDO::ATTR_ERRMODE));
        return $pdo;
    }
    catch (PDOException $e) {
        echo "Failed to get DB handle: " . $e->getMessage() . "
";
        exit;
    }
}

function connection2()
{
    $DBName2 = "db2";
    $DBUser2 = "user2";
    $DBPassword2 = "pass2";
    $DBHost2 = "localhost";


    try {
        $pdo = new PDO("mysql:host=" . $DBHost2 . ";dbname=" . $DBName2 .
            ";charset=utf8", $DBUser2, $DBPassword2, array(
            PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'utf8'",
            PDO::ERRMODE_EXCEPTION,
            PDO::ATTR_ERRMODE));
        return $pdo;
    }
    catch (PDOException $e) {
        echo "Failed to get DB handle: " . $e->getMessage() . "
";
        exit;
    }
}


$con2 = connection2();
$NewItem = $con2->prepare("select id,fid,title,sign from news_tmp");
$NewItem->execute();

$con1 = connection1();
$contwovalue = array();

for ($i = 0; $row = $NewItem->fetch(PDO::FETCH_ASSOC); $i++) {
    $NewItem2 = $con1->prepare("select id,fid,title,sign from news_tmp where id='{$row['id']}'");
    $NewItem2->execute();
    $contwovalue = $NewItem2->fetch(PDO::FETCH_ASSOC);
    if (($contwovalue['id'] == $row['id']) && ($contwovalue['fid'] == $row['fid']) &&
        ($contwovalue['sign'] == $row['sign'])) {
        $NewItem2 = $con1->prepare("UPDATE `news_tmp` SET `title`=? where id=?");
        $NewItem2->bindValue(1, $row['title'], PDO::PARAM_INT);
        $NewItem2->bindValue(2, $contwovalue['id'], PDO::PARAM_INT);
        $NewItem2->execute();
    }
}

i just want to ask this question : this way is best way ? or another way exist for this problem?

Why not just use a query for that?

UPDATE 
  database.news
SET 
  database.news.title= backupdatabase.news.title
WHERE 
  database.news.id= backupdatabase.news.id

Edit: Oh, about 6 Months late :-)