CUBRID 函数
PHP Manual

cubrid_field_table

(PECL CUBRID >= 8.3.0)

cubrid_field_table — Returns the name of the table of the specified field

说明

string cubrid_field_table ( resource $result , int $field_offset )

This function returns the name of the table of the specified field. This is useful when using large select queries with JOINS.

参数

result

Array type of the fetched result CUBRID_NUM, CUBRID_ASSOC, CUBRID_BOTH.

field_offset

The numerical field offset. The field_offset starts at 0. If field_offset does not exist, an error of level E_WARNING is also issued.

返回值

Name of the table of the specified field, on success.

FALSE when invalid field_offset value.

-1 if SQL sentence is not SELECT.

范例

Example #1 cubrid_field_table() 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) 
    {
        echo 
"Field 0 (<b>". cubrid_field_name($result, 0) . "</b>) is from table <i>" . cubrid_field_table($result, 0) . "</i><br>";
        echo 
"Field 1 (<b>". cubrid_field_name($result, 1) . "</b>) is from table <i>" . cubrid_field_table($result, 1) . "</i><br>";
        
        
cubrid_close_request($result); 
    }
?>

以上例程会输出:

Result:
Field 0 (id) is from table employees
Field 1 (name) is from table employees

CUBRID 函数
PHP Manual