Welcome Guest, Not a member yet? Register   Sign In
Community auth, inserting into 2 tables; users and customer_profiles on user creation
#1

Hi
i want insight on how to insert into two tables which will eventually  contain user information. Am using community auth to handle user management in my app and by design extra user info like first name and last name are stored in a separate table. So my question here is how will you insert into these two tables on user creation and i will also like to know the same for updating the records also.
Reply
#2

(04-08-2017, 11:02 AM)koficypher Wrote: Hi
i want insight on how to insert into two tables which will eventually  contain user information. Am using community auth to handle user management in my app and by design extra user info like first name and last name are stored in a separate table. So my question here is how will you insert into these two tables on user creation and i will also like to know the same for updating the records also.


It depends how you are handling user IDs. If you're generating a random ID before your inserts, then you'd just do both inserts in a transaction and you're done. If you're letting the users table auto_increment an ID for you, then you get the ID with db->insert_id(), and then use it in your other insert.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB