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

 Gets one field value of the result.

 

        mixed i5_result (resource result, 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 contents in current record.

 

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.

 

 Detail

 

i5_result returns the cell content of the current row. Argument may be field index or its name.

The field value is read from the current record fetched by a previous call to i5_fetch_xxx function.

 

Example

 

 

 

    $fil = i5_open("CR/CLIENT", I5_OPEN_READWRITE,$Hdlcon);

    if(is_bool($fil))

    {

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

    }

    else

    {

   

                   $seek = array("4");

                   $ret = i5_seek($fil, I5_EQ, $seek);

                   if (!$ret)

                   {

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

                   }

                   else

                   {

                                   $rec = i5_fetch_row($fil, I5_READ_SEEK);

                                   if (is_bool($rec))

                                   {

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

                                   }

 

                                                  

                                   // Fetches a single field

                                   $nom = i5_result($fil, "NOM");

                                   if (is_bool($nom) && $nom == FALSE)

                                   {

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

                                   }

                                   else

                                   {

                                                   print_r("Name = " .$nom .'<br/>');

                                   }

                                                  

                                   $compte = i5_result($fil, "COMPTE");

                                   if (is_bool($compte) && $compte == FALSE)

                                   {

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

                                   }

                                   else

                                   {

                                                   print_r("Compte = " .$compte .'<br/>');

                                   }

                   }

                                  

    } 

 

See also

 

i5_fetch_array

i5_fetch_assoc