A
A
AndTheEnd2018-01-31 16:46:46
PHP
AndTheEnd, 2018-01-31 16:46:46

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)); 

?>

SELECT command denied to user error

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artem, 2018-01-31
@proudmore

Give the user you are accessing the database the right to SELECT the query.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question