Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: PHP
Posted by: Dylan Lopez
Added: Mar 5, 2018 8:51 AM
Views: 13
  1. // --- insert a new record with transaction processing -----------
  2. $sql = "INSERT INTO Test (Color, Age) Values ('Blue', 3)";
  3. $db->TransactionBegin();
  4. if ($db->Query($sql)) {
  5.     $db->TransactionEnd();
  6.     echo "Last ID inserted was: " . $db->GetLastInsertID() . "<br /><br />\n";
  7. } else {
  8.     $db->TransactionRollback();
  9.     echo "<p>Query Failed</p>\n";
  10. }