Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7490047
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T15:30:18+00:00 2026-05-29T15:30:18+00:00

I havn’t been able to find an answer to this, and it may very

  • 0

I havn’t been able to find an answer to this, and it may very well be because it has a name i don’t know. Anywho.

If you have multiple operations on a database, e.g:

if(insert_something_to_db($data) == TRUE){
     if(delete_something_else_from_db($data2) == TRUE){
          if(update_something_related_to_the_others_in_db($data3) == TRUE){
               return TRUE;
          }
     } 
} else { 
     return FALSE;
}

If any of the nested queries fails, then the previous operations will have been concluded, which results in messy data in the database. Is it possible/is there some technique/best practice, to halt the execution of the operations, until you know if they all will be successful.

I have an example:

If a person wants to join a group, he clicks ‘Join Group’
– A notification is created in the db. This show up in the administration panel of the group owner.
– The group owner can reject/accept the application.

On Accept:
– Applicant user data is updated with the new group information.
– The Notification originally sent to the group administrator is going to be deleted
– A new notification is created for the applicant, to inform him he was accepted.

It is only if the outer most condition returns false (lets say user data updated), the actual db is holding the original data. If the first update goes through, but not the next, then the profile was updated to reflect the link with the new group, but the notification in the group administrators area is not gone.

Regards
Dennis

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T15:30:23+00:00Added an answer on May 29, 2026 at 3:30 pm

    You want all your queries to be in a transaction, to ensure an all-or-nothing behavior.

    Basically, you will :

    • start a transactions
    • do your queries
    • And finally
      • If all queries have been successful, commit the transaction
      • Else, rollback the transactions

    You might want to read, for more general informations : Database transaction

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I havn't been able to find the answer to this, and I hope theres
I havn't been able to find a solution to this problem on the internet
been following posts on this site for a while and find them very helpful.
I have a issue I havn't yet been able to find a solution on.
Ye've been very helpful so far even though I havn't been great at wording
I have a very quick question to which I havn't found an answer for.
Ok well I have been fighting with this for a while now and have
sorry if this has already been posted but I've been through umpteen posts on
I've been searching for a while now onine and just havn't been able to
There's a bunch on this topic, but I havn't found an instance that applies

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.