×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Multiple Table data entry, how to remove entered data, on error

Multiple Table data entry, how to remove entered data, on error

Multiple Table data entry, how to remove entered data, on error

(OP)
Hi All,

I have a problem here, which I think will probably need a tutorial to solve, so any appropriate links will be VERY appreciated.

I have a database with seven tables which hold details of a customers account. Each table holding seperate kinds of details (ie. address's, account config etc. etc.) I have set up primary keys and no foreign keys as they do not function in MySQL.

Now how do I implement the system so:

When I enter data to the tables, if there is an error on one table, then all the previous data that has been entered should be removed again. As if no entry has been made.

I am thinking about a making a function which is called when the error is found that will delete the last row of the tables that data has been entered into. Does this sound right or is there an easier way to do this?

If anybody has any links to using relationships in MySQL then I will be a very happy person!!!

Chris MacPherson
thedamager@hotmail.com
www.macpweb.org
Bring on the new Browza's!!

RE: Multiple Table data entry, how to remove entered data, on error

What you are asking for is called a transaction in a database program. Let's say you have 3 queries you want to use, and if any 1 query fails, all the tables revert back to the way it was before the query run. If you need that's that's called a transaction.

Unfortunately, until very recently, MySQL does not have transaction support. There are several ways around this, but since it is a rather complicated issue, the best way is to consult the MySQL on-line manual located at www.mysql.com.

RE: Multiple Table data entry, how to remove entered data, on error

(OP)
Thanks azzkicar,

I'll have a look in the manual. Usefull tip, that would have taken me ages to find out that it was called a transaction!!

Cheers

Chris MacPherson
thedamager@hotmail.com
www.macpweb.org
Bring on the new Browza's!!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close