SQL查询:从一个数据库到另一个数据库的数据传输

I am trying to transfer the required data from one database to another database using a button click . The query which am using is working fine in localhost without any issue but while hosted in cpanel (online linux hosting) .. the data is not getting transfered to another database .

I have rechecked each and every corner for database name password , user etc but could not solve the issue .

Html :-

//When the button is clicked it opens up the modal (data-target=#approveMemberModal)

      <a type="button" class="btn btn-success" data-toggle="modal"  data-target="#approveMemberModal" onclick="approveMember('.$row['id'].')"> <span class="glyphicon glyphicon-edit"></span> Approve</a></li>  

//Approve Modal

      <div class="modal fade" tabindex="-1" role="dialog" id="approveMemberModal">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title"><span class="glyphicon glyphicon-trash"></span> Approve Member</h4>
      </div>
      <div class="modal-body">
        <p>Do you really want to Approve ?</p>
      </div>
      <div class="modal-footer">
        <button type="button"  class="btn btn-danger" data-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary" id="approveBtn">Yes</button>
      </div>
    </div><!-- /.modal-content -->
  </div><!-- /.modal-dialog -->
</div><!-- /.modal -->

//Once ApproveMemberModal opens up .. there will be two options "Close" and "Yes" .. "Yes" option have id="approveBtn" which is reference to call ajax when button is clicked.

//Ajax

          function approveMember(id = null) {
if(id) {
    // click on remove button
    $("#approveBtn").unbind('click').bind('click', function() {
        $.ajax({
            url: 'php_action/approve.php',
            type: 'post',
            data: {member_id : id},
            dataType: 'json',
            success:function(response) {
                if(response.success == true) {                      
                    $(".approveMessages").html('<div class="alert alert-success alert-dismissible" role="alert">'+
                          '<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>'+
                          '<strong> <span class="glyphicon glyphicon-ok-sign"></span> </strong>'+response.messages+
                        '</div>');

                    // refresh the table
                    manageMemberTable.ajax.reload(null, false);

                    // close the modal
                    $("#approveMemberModal").modal('hide');

                } else {
                    $(".approveMessages").html('<div class="alert alert-warning alert-dismissible" role="alert">'+
                          '<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>'+
                          '<strong> <span class="glyphicon glyphicon-exclamation-sign"></span> </strong>'+response.messages+
                        '</div>');
                }
            }
        });
    }); // click remove btn
} else {
    alert('Error: Refresh the page again');
}
  }

//From Ajax it will call php file ie approve.php

PHP

      <?php 

require_once 'db_connectone.php';
require_once 'db_connecttwo.php';

$output = array('success' => false, 'messages' => array());

$memberId = $_POST['member_id'];

$sql = "INSERT INTO appsrx1a_one.candidate_tabletest (candid,mobile , secmobile) SELECT candid,mobile , secmobile FROM  appsrx1a_one.candidate_tabletest WHERE id = {$memberId}";
$sqll="DELETE FROM appsrx1a_one.candidate_tabletest WHERE id = {$memberId}";
$query = $connect->query($sql);
$query = $connect->query($sqll);

if($query === TRUE) {
    $output['success'] = true;
    $output['messages'] = 'Successfully Approved';
} else {
    $output['success'] = false;
    $output['messages'] = 'Error while approving the member information';
}

// close database connection
$connect->close();

echo json_encode($output);

From the above php file db_connectone.php have database connection of first database and db_connecttwo.php have database connection of second database

The Below query will it will select data from database one ie (appsrx1a_one) and inserts into database two ie (appsrx1a_two.candidate_tabletest)

 $sql = "INSERT INTO appsrx1a_two.candidate_tabletest (candid,mobile , secmobile) SELECT candid,mobile , secmobile FROM  appsrx1a_one.candidate_tabletest WHERE id = {$memberId}";

Once it is transfered the below query deletes the data from database one ie (appsrx1a_one)

$sqll="DELETE FROM appsrx1a_one.candidate_tabletest WHERE id = {$memberId}";

All the above functionalies are working fine in localhost without any issue .. am facing this issue only in cpanel ... in error_log am not getting any error .

What might be the issue in this code . If the above method is wrong provide the proper method to this . Thanks

Check the database name. cPanel creates the databases different using cpaneluser_dbname. Check the database credentials like mysql user, password to be sure that the configure mysql user has access to the configured mysql database (you can allow permissions to a database to a specific mysql user using the cPanel web interface). If you have shell access you can try to run the script manually from a ssh console. You could modify the script an add debugging to it like printing the status at different stages in the script to check where exactly the script is, what's the last output of the last executed command