Comments - Access to more databases

3 years, 6 months ago Lon Hammonds

This sounds like a connection definition problem. You should be using two different connections, one per database. When building your queries, you should be referencing the database connection for the database you want to query.

Example:

$cnn_db1 = mysqli_connect($Servername, $Username, $Password, $Database1);
$cnn_db2 = mysqli_connect($Servername, $Username, $Password, $Database2);
$rst_query1 = mysqli_query($cnn_db1, "SELECT * FROM Users")
$rst_query2 = mysqli_query($cnn_db2, "SELECT * FROM Users")
mysqli_free_result($rst_query1);
mysqli_free_result($rst_query2);
mysqli_close($cnn_db2);
mysqli_close($cnn_db1);
 
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.