When someone registers in my online store, how to identify if they have alr

Hi guys. I have just created an intranet in my online store and I'm new at programming so need some help. I'm developing a system that makes this possible: when a user registers, the database detects that they are already a customer who has bought previously and it makes their purchases appear on another page, in this case, in the section of their profile.

I need some help since I don't know how to do it or how to link the php and Mysql code between the registration form and the existing user profile page since it is not a tool that prints the user's data on the same page but rather prints them in another, in the profile section.

Thank you very much in advance! :)