0

I know how to join table or database but the problem is that my database is on a different domain. So when we can make a connection for any DB that's fine but now we have to join with DB and table so in my mysqli_query.

So it only lets us select one connection and other the connection query had failed, code is below is there any trick on how to cover this problem, NOTE both connection have different login detail


$connect_db = mysqli_connect(DB_SERVER,DB_USERNAME,DB_PASSWORD,DB_DATABASE);
$connect_db_1 = mysqli_connect(DB_SERVER_1,DB_USERNAME_1,DB_PASSWORD_1,DB_DATABASE_1);


$m_db = mysqli_query($connect_db_1,"INSERT INTO shopcord.table (userid,title,username,groupid,last_login,status,is_email_confirmed) $connect_db, SELECT id,'Member',person_name,'0','$uk_date','inactive','0' FROM onlineshoping.table WHERE id = '31'");

        if ( !$m_db ) {
            echo 'one';
            exit();
        } else {
             echo 'two';
            exit();
        }

jAY
  • 1
  • 3
  • 2
    Does this answer your question? [MySQL Cross Server Select Query](https://stackoverflow.com/questions/810349/mysql-cross-server-select-query) – Progman Jun 15 '21 at 20:35
  • You can't join SQL across two servers like this. This is exactly why you need PHP. Read the data through PHP from both and then process in PHP – Dharman Jun 15 '21 at 20:49

0 Answers0