PreviousNext
Help > API Functions > Data Areas > i5_data_area_write
i5_data_area_write

 

Writes data to the area.

 

      bool i5_data_area_ write (string name, string value, [, int offset, int length] [, resource connection])

Parameters

 

 

name

Name of the data area.

value

Value to write.

offset

Offset for the data.

length

Length of the data to read.

connection

Connection – result of i5_connect


If not offset is specified, all the area is written. If value is shorter than length it is padded to the length. If it's longer it is truncated.

 

Return

True if OK, false if failed.

 

I5_ERR_PHP_HDLDFT

256

No default connection found.

I5_ERR_PHP_HDLCONN

257

This resource has no connection active.

I5_ERR_PHP_RESOURCE_BAD

261

No resource found.

I5_ERR_PHP_TYPEPARAM

262

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

I5_ERR_PHP_NBPARAM_BAD

263

Wrong parameter count

I5_ERR_PHP_EMPTY_NAME

314

Object name cannot be empty

I5_ERR_PHP_BAD_DTAARA_LENGTH

315

Data area x should be from -1 to -2

 

 

Example

 

 

$ret = i5_data_area_create ("QTEMP/MYDTA" , 50);

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

 

$ret = i5_data_area_write ("QTEMP/MYDTA" , "MSG:Hello Word");

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

 

$ret = i5_data_area_read ("QTEMP/MYDTA", 1, 4);

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

echo "Type data: $ret<BR>" ;

 

 $ret = i5_data_area_read ("QTEMP/MYDTA");

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

 echo "Message: $ret<BR>";

 

 $ret = i5_data_area_delete ("QTEMP/MYDTA");

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