'Connecting 2 mysql table (users) [duplicate]

I need some help to connect the 2 mysql table (users). Like I created 2website both 2 different dynamic website but I redirected them on each other. So If any user register on 1 it should be registered on both so he/she don't need to signup again and again. Both dynamic website are hosted on same domain but 2 different mysql. But I want just users table to be common.

It will be great help you guys help me.

Thank You

I don't have any good idea how I'll do this.



Solution 1:[1]

One of the ways. You need create one database (one table users) and connect to it from your dynamic web-sites.

Change your code to look like:

$mysqliNew = new mysqli("localhost", "username", "password", "here_database_users"); // init connection (at the start of the script)

At the right place use new variable $mysqliNew:

$mysqliNew->query("SELECT `id` FROM `users` WHERE `id` = 1");

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Sergei