Joining tiered DBs in mySql, custom question

I am concatenating two DBs together to complete a request.

$strSQL = "SELECT tbl.SecurityKey,
           CONCAT(u.firstname,' ',u.lastname) AS fullname 
           FROM $CFG->paymentdbname.tblPayment tbl 
           JOIN $CFG->dbname.vle5_user u 
           ON = " . $uid . " 
           WHERE VendorTxCode='" . mysql_real_escape_string($strVendorTxCode) . "' and VPSTxId='" . mysql_real_escape_string($strVPSTxId) . "'";


The problem I am facing is that each DB has its own user, so when I try to query with any user it fails as the user does not have the correct privileges.

I had a good hunt in the Plesk control panel as I could answer that the DB user has access to both, but that doesn't seem like an option.


source to share

1 answer

You can process multiple databases in one sql query only if the user connected by mysql_connect is allowed to access both databases.

Go to control panel and add all privileges for user X for DB A and B. After that you can use two different DB in one Sql



All Articles