2
If the user registers from an email, it would look something like:
INSERT INTO user (id_user, nome, email, senha) VALUES (DEFAULT, "Fulano", "[email protected]", "1234");
INSERT INTO user_controller (id_controller, id_user) VALUES (DEFAULT, LAST_INSERT_ID());
The first line adds user data in user
and the second inserts the foreign key into the relation table user_controller
. In this case, LAST_INSERT_ID()
return the value of id_user
generated in the first instruction.
For registration from Facebook would be something very similar:
INSERT INTO user_fb (id_userfb, nome, sobrenome, idfacebook) VALUES (DEFAULT, "Fulano", "Snow", "314159");
INSERT INTO user_controller (id_controller, id_userfb) VALUES (DEFAULT, LAST_INSERT_ID());
In this case, the foreign key would be written in the column id_userfb
.
Thanks for the help. I have one more question could help me?
– Malfus
Just create a new question on the site with her.
– Woss