Xtremer360 Posted August 28, 2012 Share Posted August 28, 2012 I'm curious to know if someone could explain some logic on how to write a specific function. In my register controller I have a function called create_user. When the function gets called it runs a function in my model called insert user that inserts set data such as username, email address, name, etc. to the users table as a new row. It returns te user_id (auto increment id) back to the create user function then if the user_id is more than one the runs the insert_registration_details model function that inserts user data into the registrations table like the ip address, browser, etc.. If it fails to insert into that table I want it to go back and delete the user in the users table. How can I achieve this if the database user doesn't have delete privileges. Quote Link to comment https://forums.phpfreaks.com/topic/267680-logic-based-on-prior-inserts/ Share on other sites More sharing options...
Christian F. Posted August 28, 2012 Share Posted August 28, 2012 You'll probably want to use database transactions for this one, if I've understood you correctly. Quote Link to comment https://forums.phpfreaks.com/topic/267680-logic-based-on-prior-inserts/#findComment-1373098 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.