07-14-2017, 10:03 PM
>Not sure what you’re talking about,
That's kind of weird because your tables are InnoDB and the point of them is to have transactions.
Anyway, here's an example:
Apparently PDO has its own functions for transactions.
That's kind of weird because your tables are InnoDB and the point of them is to have transactions.
Anyway, here's an example:
Code:
$commit = false;
Code:
$db->query("START TRANSACTION");
Code:
if ($db->insert("people", ["name"=>"jim"]))
Code:
if ($db->insert("houses", ["personID"=>$db->lastId()]))
Code:
$commit = true;
Code:
$db->query($commit ? "COMMIT" : "ROLLBACK");
Apparently PDO has its own functions for transactions.