Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

Versions available for this page: CUBRID 8.3.0 |  CUBRID 8.3.1 |  CUBRID 8.4.0 |  CUBRID 8.4.1 | 



cubrid_result

Description

The cubrid_result function retrieves the contents of one cell from a CUBRID result set on success, or FALSE on failure.

When working on large result sets, you should consider using one of the functions that fetch an entire row. As these functions return the contents of multiple cells in one function call, they're MUCH quicker than cubrid_result(). Also, note that specifying a numeric offset for the field argument is much quicker than specifying a fieldname or tablename.fieldname argument.

Syntax

string cubrid_result ( resource $result , int $row [, mixed $field= 0 ] )

  • result : Result that comes from a call to cubrid_execute()
  • row : The row number from the result that's being retrieved. Row numbers start at 0.
  • field : The name or offset of the field being retrieved. It can be the field's offset, the field's name, or the field's table dot field name (tablename.fieldname). If the column name has been aliased ('select foo as bar from...'), use the alias instead of the column name. If undefined, the first field is retrieved.
Example

<?php

$conn = cubrid_connect("localhost", 33000, "demodb");

 

$req = cubrid_execute($conn, "SELECT * FROM code");

 

$result = cubrid_result($req, 0);

var_dump($result);

 

$result = cubrid_result($req, 0, 1);

var_dump($result);

 

$result = cubrid_result($req, 5, "f_name");

var_dump($result);

 

cubrid_close_request($req);

cubrid_disconnect($conn);

?>

 

The above example will output:

 

string(1) "X"

string(5) "Mixed"

string(4) "Gold"