Jump to content

Connect two tables


PeterBubresko

Recommended Posts

I am in the process of putting together a system where I include a MySQL database. In this I have table user which contains username in the form of an email address, and the password. The page includes a good deal of user information, therefore passwords and usernames are separated to only be in the users table. The other user information I need, but which is kept away from the users table, is the user_inf table. Is it possible to somehow connect these two tables together? so that I can still retrieve the user information where I want/need? This has something to do with the fact that I need the user's e-mail address elsewhere together with the information in the user_inf table, yes also..... argh, forget it.
Is there a solution so that my users do not need to register their e-mail address in two places in the registration form in order to save it in two different tables? Primary key is ID .

Link to comment
Share on other sites

7 minutes ago, PeterBubresko said:

Is there a solution so that my users do not need to register their e-mail address in two places

Indeed there is. In fact the email address should not be in two places. The only item that would appear in more than one table is the ID.

Just JOIN the tables on the user_id when you need info from both tables.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.