Icon edb_commit

Commits the current transaction in the current database.

Syntax
edb_commit(<ConnectionHandle>)

<ConnectionHandle> =

Handle of connection returned by edb_connect function

Returns
TRUE if successful, or FALSE if there are any errors

Usage
The edb_commit function commits the current transaction in the current database.

Please see the Transactions topic in the SQL manual for more information on how transactions work in ElevateDB.

Examples
<?php

// The following script connects to an ElevateDB
// Server and database, starts a transaction on
// the Customer and Orders tables using the
// edb_starttrans() function, inserts a row
// into each table, commits the transaction
// using the edb_commit() function, and then
// disconnects using the edb_disconnect() function

$con = edb_connect("type=remote;charset=Ansi;address=127.0.0.1;"+
                   "uid=Administrator;pwd=EDBDefault;database=Test");
if (!$con)
  {
  die("Could not connect: " . edb_errmsg());
  }

edb_starttrans($con,array("Customer","Orders"));

echo edb_intrans($con);

$custcmd = edb_prepare($con,"customer",EDB_COMMAND_TABLE);
$custcursor = edb_execute($custcmd);

$ordcmd = edb_prepare($con,"orders",EDB_COMMAND_TABLE);
$ordcursor = edb_execute($ordcmd);

edb_insert($custcursor);
edb_setcol($custcursor,"CustNo",1000);
edb_setcol($custcursor,"Company","Test Company");
if (!edb_post($custcursor))
  {
  $msg = edb_errmsg();
  edb_rollback($con);
  die("Error adding customer: " . $msg);
  }

edb_insert($ordcursor);
edb_setcol($ordcursor,"CustNo",1000);
edb_setcol($ordcursor,"OrderNo",100);
edb_setcol($ordcursor,"SaleDate","2010-02-24");
edb_setcol($ordcursor,"EmpNo",10);
if (!edb_post($ordcursor))
  {
  $msg = edb_errmsg();
  edb_rollback($con);
  die("Error adding order: " . $msg);
  }

edb_commit($con);

edb_disconnect($con);
?>
Image