alohatofu Posted April 19, 2007 Share Posted April 19, 2007 I think this is where this question should be asked. please let me know if I posted on the wrong forum. I was wondering if someone could give me some guidance in mirroring 2 databases with their username and password fields only. I have 2 databases that I would like to mirror with the username and password. Is it possible if so, please help. Do i setup a script? cronjob? Thank you! Link to comment https://forums.phpfreaks.com/topic/47726-mirror-username-password-field/ Share on other sites More sharing options...
Wildbug Posted April 19, 2007 Share Posted April 19, 2007 Do you really want the two databases (er, username/password columns) "mirrored", or do you want the user to be able to log into both "applications" using the same information? Could you just use two connections -- one to your database with the uname/pass and one to the other -- within the same script? Use just one table for authentication. Or put a line of code in each application which INSERTs the info in the other database. If this sounds okay, see the PHP manual for using multiple database connections -- it'll be under mysql_connect, and you'll need a variable to keep track of which connection. Link to comment https://forums.phpfreaks.com/topic/47726-mirror-username-password-field/#findComment-233213 Share on other sites More sharing options...
alohatofu Posted April 19, 2007 Author Share Posted April 19, 2007 I really want the fields username/password to be mirrored. I have 2 applications (one is xoops) and another custom application. I want them to be able to use the username/password from xoops on the new application and vice versa without having to create an account on the custom application. I already have the username and password field and authentication method for the custom application (able to login if I create the account). I've looked at the manual but unable to get anywhere. I'm a newbie at mysql and php. any help will be greatly appreciated. Link to comment https://forums.phpfreaks.com/topic/47726-mirror-username-password-field/#findComment-233275 Share on other sites More sharing options...
Wildbug Posted April 19, 2007 Share Posted April 19, 2007 Why don't you just run an extra query on an CREATE/UPDATE of a particular database? For an xoops CREATE or UPDATE: INSERT INTO users (username,password) VALUES ('xxx','yyy'); INSERT INTO customapp.users (username,password) VALUES ('xxx','yyy'); UPDATE users SET password='zzz' WHERE username='xxx'; UPDATE customapp.users SET password='zzz' WHERE username='xxx'; Reverse it for the other way around. You'll need permissions on both databases. You'll also need to check for the presence of a pre-existing username on the opposite database previous to INSERTing any values. Link to comment https://forums.phpfreaks.com/topic/47726-mirror-username-password-field/#findComment-233328 Share on other sites More sharing options...
bubblegum.anarchy Posted April 19, 2007 Share Posted April 19, 2007 Can a trigger insert records from one database table to another? Link to comment https://forums.phpfreaks.com/topic/47726-mirror-username-password-field/#findComment-233552 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.