I have a script who does multiple UPDATE on my InnoDB, but if one UPDATE fail, I want all the other UPDATE to be rollback. So I searched over the web and the best I could find was PDO::beginTransaction. Except that I want my DB to be actually updated for every UPDATE and if one of them fail, I need to delete every previous UPDATE. I need this because this script can be run from multiple user, and the previously updated row shouldn't be updated again.
exemple :
here's my table "reserver" :
id | idChambre | idReservation
---+-----------+--------------
0 | 1 | 1
the first row means that the room 1 is matched with the order 1 so it can't be matched again. So if nothing wrong happens this row will stay the same, but if the user cancel or timeout event occurs, I want this row to be deleted.
So now I see 2 way : pdo Transaction (but I don't know how) and my actual way : storing every id of my "reserver" table and delete them all if something wrong occurs.
Is there any better way ? Am I doing it wrong ?
English is not my native language so be nice please.