Cubrid Functions
PHP Manual

cubrid_num_fields

(PECL CUBRID >= 8.3.0)

cubrid_num_fieldsReturns the number of columns in the result set

Description

int cubrid_num_fields ( resource $req_identifier )

This function returns the number of columns in the result set, on success, or it returns FALSE on failure.

Parameters

req_identifier

This is the request identifier.

Return Values

Number of columns, on success.

-1 if SQL sentence is not SELECT.

Examples

Example #1 cubrid_num_fields() example

<?php
    $link 
cubrid_connect("localhost"30000"demodb2""dba""");
    if (!
$link)
    {
        die(
'Could not connect.');
    }
    
$query 'SELECT id, name, address, salary FROM employees';
    
$result cubrid_execute($link$query);
    if (
$result
    {
        
$n cubrid_num_fields($result);
        echo 
"The resultset contains ".$n" fields: ";
        for (
$i 0$i $n$i++)
            echo 
cubrid_field_name($result$i)." ";
        
        
cubrid_close_request($result); 
    }
?>

The above example will output:

Result:
The resultset contains 4 fields: id name address salary

Cubrid Functions
PHP Manual