Dark
Dark

Reputation: 515

Secure php script execution

I'm executing thousand of 'insert' in my mysql Database with a php file. If the php crash before finishing, to be sure that my update failed, I don't want to have 5000 'insert' on 10 000 done but 0.

Can you tell me how that's possible?

Upvotes: 0

Views: 91

Answers (3)

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 798726

Perform all inserts in a single transaction.

Upvotes: 2

deceze
deceze

Reputation: 522145

Wrap your operations into Transactions.

Upvotes: 2

penguinvasion
penguinvasion

Reputation: 156

You can do this by using a Transaction. The implementation varies depending on the database. A transaction will ensure that the entire task is completed, or none of it is, as you've described.

Upvotes: 4

Related Questions