switching from database to database
|
|
For part of a site im doing, there are two options:
1. where theres a username, store the actual username in the field
2. Store the userid, and reference a users table from another database (phpbb).
Im unsure which would be the better option. Whats worse, storing usernames time and time again in a table, or connecting and re-connecting to both databases?
For the second option, i could connect once to phpbb, and once to the sites database. I am closing the mysql link with mysql_close(); after each time a database is finished being used, so theres no case of an un-needed amount of connections.
Another alternative, but im unsure it exists. Whenever theres ANY change to phpbb's user table, it copies it to the sites database. But im not keen on editing phpbb's code at all.
[edit]
Solution:
make a table in the sites database for storing users. In login.php, if the login was successful (checking from the users table in phpbb's database) check the users table on the sites database. If there is a match there, leave it alone. If not, add the user information to it (username, password, user_rank).
If the user changes forum password, it wont match a row in the site database, so it will create a new one. However, it will then delete a previous row with that user id.
__________________
It's Me
if(!$success){$try++;}
else if($success >= 100%){unset($try);}
Last edited by Diagmato; 08-09-2005 at 04:21 PM.
|