Login communication profile

I am developing a competition platform for my sport and I'm kind of stuck in a problem. I'm not sure if it should be identified as a database design problem or a programming problem. I am using PHP and MySQL.

Example: I am the organizer of the competition. I need to register all athletes for this competition, and I will do so by searching the athlete database to see if it already exists. If the athlete is not found, I just create a new one on the fly. Later, the athlete comes and wants to register on the page, he wants to create a login. I want to associate my login with an athlete profile, and I thought I would do this by having a login table and an athlete table and somehow link the two. I know exactly how to do it. How to check which athlete profile belongs to the person creating the login. How to create a relationship between these two tables. I know this is done with a foreign key, this is not my problem. But how do I go "Hey, do you want to create your own login? Listen, I thinkthat your existing athlete profile was found, should I link your username to it? "

Do you understand what my question is? If you need more information, let me know. I am struggling to explain myself.

+3


source to share


1 answer


Create two tables, one for profile information and one for storing login information. When saving a new athlete, be sure to create both entries (username and profile), even if you do not have user login information. Since you already have a login record, you can associate a profile record with it. When a user comes to your system to register, simply enter the data records (e.g. email, name, etc.) and update them.

Email can only be stored in the login table.



You can use email confirmation to make things more secure.

+1


source







All Articles