0

Can we connect more than one database at a time in phpMyAdmin using PHP? And yes then how? Here I use a variable database_name which contain database name and for connecting take a variable $database_selection and connect a single database which name is criminal_circum. If I want to connect more than one database instead of single database so,what should I do?

$database_name  = "criminal_circum";
$db_handle      = mysqli_connect($db_server_name, $db_user_name, $db_password);
$database_selection = mysqli_select_db($db_handle, $database_name);
Masoud Mokhtari
  • 2,390
  • 1
  • 17
  • 45
  • Unclear what you're asking, But if you mean connect to two database at the same time, just define another variable `$database_name2` that's all! – Pedram Feb 17 '18 at 08:04
  • yes,i can create another variable for second database,but can i use of an array instead of define different different variable and store all database name.? – ManharSinh Zala Feb 17 '18 at 08:26
  • Actually No, just for better coding you can create a `function` or `class` but in this case you can use multiple variable not array. More information https://stackoverflow.com/questions/274892/how-do-you-connect-to-multiple-mysql-databases-on-a-single-webpage – Pedram Feb 17 '18 at 08:31
  • 1
    thank you for answering,actually i am beginner programmer,so lots of things which i don't know.thank you once again. – ManharSinh Zala Feb 17 '18 at 08:44

0 Answers0