How to retrieve the last row of a table and insert it into another table : <p>i want to retrieve a last row added in table A and insert all row into table B. The 2 table are in different database.My code:</p>

<pre><code>    $db=new PDO('mysql:host=localhost;dbname=service','root','');
    $db1=new PDO('mysql:host=localhost;dbname=service1','root','');


    $req = $db-&gt;query('SELECT * FROM `service`.`myusers` WHERE ID NOT IN (SELECT ID FROM `service1`.`myusers`)');
    $reqt = $req-&gt;fetch();
    $count = $req-&gt;rowCount();

   if($count){
      $db1-&gt;query('SET NAMES UTF8');
     $reqa=$db1-&gt;prepare('insert into myusers values(?,?,?,?,?,?)');
     $db1-&gt;query('SET NAMES UTF8');
     $reqa-&gt;bindParam(1,$reqt['ID']);
     $reqa-&gt;bindParam(2,$reqt['Prénom']);
     $reqa-&gt;bindParam(3,$reqt['LastName']);
     $reqa-&gt;bindParam(4,$reqt['dateDebut']);
     $reqa-&gt;bindParam(5,$reqt['identifient']);
     $reqa-&gt;bindParam(6,$reqt['fid']);
     $reqa-&gt;execute();
        return true;
    }else{
        return false;
    }
</code></pre>

<p>But doesn't work.</p>
