title: How to get data from a different database and save it to another database
body: <p>I don't know if this problem of mine is possible. Is it? I have a library system. I add and edit new books in the Catalog Database. In other words, the Catalog Database is for adding/editing books only. I have another Database (not table) for Borrowing Books. I want to store these books, which are viewed through Catalog DB, to Borrowing DB.</p>
  
  <p>I have a snippet for getting data from Catalog DB</p>
  
  <pre><code>error_reporting(0);
  $con = mysql_connect("localhost","root","");
  mysql_select_db("catalog", $con);
  
  $acc_number=$_GET["acc_number"];
  
  $query="select * from branch where acc_number = '$acc_number'";
  $result=mysql_query($query);
  
  while ($row = mysql_fetch_array($result)) {
    //echo $row[1];
  }
  &lt;textarea name="title" disabled&gt;&lt;?php echo $row[1];?&gt;&lt;/textarea&gt;
  </code></pre>
  
  <p>And a button for the submission (store to borrowing database). If button is clicked, it's where my problem occurs. I just got a blank page after submitting it. Here is my process.php:</p>
  
  <pre><code>$con = mysql_connect("localhost","root","");
  mysql_select_db("catalog", $con);
  
  $acc_number = $_POST['acc_number'];
  $title = $_POST['title'];
  
  $sql = mysql_query("select * from books where acc_number='$acc_number'");
  
  while($row=mysql_fetch_array($sql)){
    $con = mysql_connect("localhost","root","");
    mysql_select_db("borrowing", $con);
  
    $query="INSERT INTO borrowers (title) VALUES ('$title')";
    mysql_query($query);
    if($query){
      header("Location:../librarysystem/books.php");
    }
  }
  </code></pre>