The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
transaction with DB Class
#8
>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:

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.
  Reply


Messages In This Thread
transaction with DB Class - by marceloatmartins - 07-12-2017, 08:19 PM
transaction with DB Class - by mudmin - 07-12-2017, 10:27 PM
transaction with DB Class - by marceloatmartins - 07-13-2017, 10:59 AM
transaction with DB Class - by firestorm - 07-13-2017, 01:16 PM
transaction with DB Class - by mudmin - 07-13-2017, 01:20 PM
transaction with DB Class - by marceloatmartins - 07-14-2017, 10:50 AM
transaction with DB Class - by marceloatmartins - 07-14-2017, 11:07 AM
transaction with DB Class - by faguss - 07-14-2017, 10:03 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)