How can I implement commit/rollback for MySQL in PHP?
Well basically I have this script that takes a long time to execute and occasionally times out and leaves semi-complete data floating around my database. (Yes I know in a perfect world I would fix THAT instead of implementing commits and rollbacks but I am forced to not do that) Here is my basic code (dumbed down for simplicity): $database = new PDO("mysql:host=host;dbname=mysql_db","username","password"); while (notDone()) { $add_row = $database->prepare("INSERT INTO table (columns) VALUES (?)"); $add_row->execute(array('values')); //PROCESSING STUFF THAT TAKES A LONG TIME GOES HERE }