Sets an upper range bound for the file. Once the bound is set, the first line for all seeks becomes the line defined by the range.
|
Bool i5_range_from ( |
resource file , |
Sets the lower filter limit in a file according to one or several keys values set as parameters in table.
Range may be enabled or disabled for each open file.
I5_range_from and i5_range_to functions, used together or alone will activate the range. To get full file access i5_range_clear function must be run
Using i5_range_from without calling i5_range_to, range will go from specified limit to file end.
Using i5_range_to without calling i5_range_from, range will go from file start to specified limit.
Upper and lower limits can be set equal:
$commun = array("FAMILY" => "WHOLESALERS");
$ret = i5_range_from($file, true, $commun);
$ret = i5_range_to($file, true, $commun);
"included" parameter is a Boolean (TRUE or FALSE) specifying if the limit is included or not in the range.
If the value is FALSE the lower limit (set with i5_range_from) will be the following record and the upper limit (set with i5_range_to) will be the last record.
|
file |
i5 file resource.
|
|
included |
True if the field with this key should be included in the range, false otherwise.
|
|
values |
Values for the key fields - array of key=>value pairs.
|
Returns:
True if OK, false if failed.
Error returned
|
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. |
|
I5_ERR_PHP_VARIABLE |
281 |
You can't use the I5_bind_param function and specify parameters |
$file = i5_open('EASYCOM/NCLIENT');
if (is_bool($file)) trigger_error('i5_open error : '.i5_errormsg(), E_USER_ERROR);
$first = array('CNOM' => 'D');
$last = array('CNOM' => 'F');
$ret = i5_range_from($file, true, $first);
if (!$ret) trigger_error('i5_range_from error : '.i5_errormsg(), E_USER_ERROR);
$ret = i5_range_to($file, false, $last);
if (!$ret) trigger_error('i5_range_to error : '.i5_errormsg(), E_USER_ERROR);
echo 'i5_fetch_row : <BR>';
i5_seek($file, I5_FIRST);
while ($tab = i5_fetch_row($file)) {
printf('%s (%s)<BR>', $tab[3], $tab[2]);
}