How to use two database connections in php?

<?php $con1 = mysqli_connect("localhost","root","","db_name1"); $con2 = mysqli_connect("localhost","root","","db_name2"); $emp_db1 = "SELECT emp_id, emp_name FROM employees"; $emp_db1_data = mysqli_query ($con1, $emp_db1); $emp_db2 = "SELECT emp_id, emp_name FROM employees"; $emp_db2_data = mysqli_query ($con2, $emp_db2); ?>

Share This: