A site that has a db that holds the login info for users username pwd and profile info. I want to add another db holding user data that I want shown when the user visits their pages.
How do I associate the logged in user with his data in the second db.
The second db is not created yet so I have freedom to create it as I want, but it must be separate from the db with the login info.
I know that this is probably one of those things that php and mysql developers do all the time, but I have drawn a blank on understanding how to do this. Therefore any help would be appreciated
Thanks
once the user has been logged in, you should be able to just connect to the second database in the same way you connected to the 1st database, to check their username/password, but this time using the paramaters of the 2nd database.
@Guido2004 another database that will have many tables.
@Kalon
once the user has been logged in, you should be able to just connect to the second database in the same way you connected to the 1st database, to check their username/password, but this time using the paramaters of the 2nd database.
OK so would I need to use a field from the user db to associate the data in the second db. Therefore I would have to create a field in the second db that appears in the first db to make the link.
Here is my attempt in psuedo code
$mysql_result=mysql_query("SELECT * FROM dbname and tablename1, tablename2,tablenameN WHERE id="value-from-first-db,showfields;
I do not know whether that helps, I am trying to learn this stuff and my head hurts.
@Kalon: The reason I need to use another db is that the login info is in a db created by a proprietary piece of software, and if an update is done to that software, I would have no control over what it might do to any other tables I create.
True, unless the user wants to change their username. Then you’d need to update it in two separate databases instead of just one. Nobody ever wants to change their user id (usually you don’t even know you have one).
If the username is immutable, then it doesn’t make a difference.