Reputation: 383
i currently have several sites that work together but each have their own registration pages such as
as said each of them has their own registration pages and each of them has their own database what i am wanting to do is combine all the registration pages into 1 central registration area where they just register on the single page and it creates an account for all of them but the problem is i don't know how to wright data to multiple databases simultaneously and how to specify what data goes to what database and what tables it wright it to for each database
each database has a different name, username and table structure but all of the databases have the same password
if you haven't figure out this is php and mysql
Upvotes: 0
Views: 325
Reputation: 5846
I should have made an master_user_table in one database, and let the registrationpage store the user there. and then let the other databases copy userdata from this table, that way you know what data is the main data, and what data is just copies. a even better way is to use view insted of tables in the other tables, that way the data is only stored on one place, and is always up to date.
CREATE VIEW users LIKE SELECT username, password, email FROM master_user_database.users;
Upvotes: 0
Reputation: 3877
Different queries on seperate databases...
$c1 = new mysqli("localhost", "user1", "pass1", "db1");
$c2 = new mysqli("localhost", "user2", "pass2", "db2");
$c1->query("INSERT INTO `members` (`user`, `pass`) VALUES ('user', 'pass') ");
$c2->query("INSERT INTO `members` (`user`, `pass`) VALUES ('user', 'pass') ");
Upvotes: 3