Answer the question
In order to leave comments, you need to log in
How to display information from two different databases?
Good afternoon. Tell me please. I need to display information from two different databases
There are 2 identical tables - They have the same columns
name, id
<?php
$direct = '/connect.php';
require_once $direct;
$link = mysqli_connect($host, $user, $password, $database)
or die("Ошибка " . mysqli_error($link));
mysql_select_db(db,$link);
$link1 = mysqli_connect($host1, $user1, $password1, $database1)
or die("Ошибка " . mysqli_error($link1));
mysql_select_db(db2,$link1);
$query ="SELECT name FROM db.name inner join db2.name ORDER BY id";
$result = mysqli_query($link, $query) or die("Ошибка " . mysqli_error($link));
?>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question