Icon edb_update

Puts a cursor into the update state and retrieves the most current version of the current row.

Syntax
edb_update(<CursorHandle>)

<CursorHandle> =

Handle of cursor returned by edb_execute function

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

Usage
The edb_update function puts a cursor into an update state (EDB_UPDATE_STATE), and retrieves the most current version of the current row. If the cursor's parent connection is using pessmistic row locking, then the current row is automatically locked at this time. If the cursor's parent connection is using optimistic row locking, then the current row will not be locked until the edb_post function is called. For more information on setting the row lock protocol, please see the Connection Strings topic.

Warning If the cursor state, retrievable via the edb_state function, is an insert state (EDB_INSERT_STATE) or update state (EDB_UPDATE_STATE), then this function will cause an automatic call to the edb_post function in order to force the cursor into a browse state (EDB_BROWSE_STATE).

<?php

// The following script connects to an ElevateDB
// Server and database, prepares and executes a
// direct table open, finds a row, puts the cursor
// into an update state using the edb_update() function,
// sets the row values, and then completes the update

$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());
  }

$cmd = edb_prepare($con,"customer",EDB_COMMAND_TABLE);
$cursor = edb_execute($cmd);

if (edb_find($cursor,array(1000)))
{
  edb_update($cursor);
  edb_setcol($cursor,"Company","My Company 2 - Electric Boogaloo");
  if (!edb_post($cursor))
    {
    $msg = edb_errmsg();
    die("Error updating customer: " . $msg);
    }
}

edb_disconnect($con);
?>
Image