Cubrid Functions
PHP Manual

cubrid_num_fields

(PHP 4, PHP 5)

cubrid_num_fieldsReturns the number of columns in the result set

Description

int cubrid_num_fields ( int $result )

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

Parameters

result

This is the result handle that is evaluated. This result is obtained by a call to cubrid_execute().

Return Values

Number of columns, on success.

FALSE on failure.

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