PreviousNext
Help > API Functions > Columns & parameters information > i5_field_len
i5_field_len

 

 Gets field length.

 

         int i5_field_len (resource result/file, int/string field)

 

Parameters

 

result

Resource describing file or other record set

 

field

Integer or string identifying the field position or name.

 

 

Return

 

Field's length. False is returned if error.

 

 

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

 


                                 $fields = i5_list_fields($file);

                                 if (is_bool($fields))

                                 {

                                                   print_r("i5_list_fields error : ".i5_errormsg().'<br/>');

                                 }

                                 else

                                 {

                                                  $nb_fields = count($fields);

                                                   echo "s_customer file contains ".$nb_fields." fields.<br/>";

              

                                                   echo "Columns are as follow:<br/>";

                                                   for ($i=0; $i < $nb_fields; $i++)

                                                   {

                                                                    $type = i5_field_type($file, $i);

                                                                    $name  = i5_field_name($file, $i);

                                                                    $len  = i5_field_len($file, $i);

                                                                    if (is_bool($len))

                                                                    {

                                                                                      print_r("i5_field_len error : ".i5_errormsg().'<br/>');

                                                                    }

                                                                    echo $type . " " . $name . " " . $len. '<br/>';

                                                  }

                                 }

 

See also

 

i5_field_name

i5_field_type

i5_field_scale

i5_info