PreviousNext
Help > API Functions > Native database access > i5_update_record
i5_update_record

 

Updates the current record using the data provided.

 

           bool i5_update_record (resource file, array data)

 

Parameters

 

 

file

File handle returned by i5_open.

 

data

Data array to containing update information.

The array can be a flat or associative array.

If an associative array is specified, the key is the name of field and the value pair contains the value of the field.

 

 

Return

True if OK, false if failed.

 

I5_ERR_PHP_HDLDFT

256

No default connection found.

I5_ERR_PHP_OPTIONSTYPE

259

The type of " I5_OPTIONS_ALIAS" option must be x

and not x

I5_ERR_PHP_OPTIONSNUMBER

260

Option number -1 is unknown.

I5_ERR_PHP_TYPEPARAM

262

Type of element x in parameter -1 must be y.

Type z was provided.

 

 

Example

 

 

$hdlFile = i5_open ("EASYCOM/SP_DET_OR", I5_OPEN_READWRITE);

 if (IS_BOOL($hdlFile)) trigger_error("i5_open error : ".i5_errormsg(), E_USER_ERROR);

 

$ret = i5_new_record ($hdlFile , array (2500, "1", 11564, "5", 5));

 if (!$ret) trigger_error("i5_new_record error : ".i5_errormsg(), E_USER_ERROR);

 echo "New record inserted <BR>";

 

 $ret = i5_seek($hdlFile, "=", array(2500));

 if (!$ret) trigger_error("i5_seek error : ".i5_errormsg(), E_USER_ERROR);

 

 $rec = i5_fetch_row($hdlFile, I5_READ_SEEK);

 if (is_bool($rec)) trigger_error("i5_seek error : ".i5_errormsg(), E_USER_ERROR);

 

 $ret = i5_update_record ($hdlFile , array ("quantity" => 50));

 if (!$ret) trigger_error("i5_new_record error : ".i5_errormsg(), E_USER_ERROR);

 echo "New record updated <BR>";