fbsql_fetch_field

(PHP 4 >= 4.0.6, PHP 5, PHP 7)

fbsql_fetch_fieldGet column information from a result and return as an object

说明

fbsql_fetch_field ( resource $result [, int $field_offset ] ) : object

Used in order to obtain information about fields in a certain query result.

参数

result

fbsql_query()fbsql_db_query() 返回的结果标识符。

field_offset

The numerical offset of the field. The field index starts at 0. If not specified, the next field that wasn't yet retrieved by fbsql_fetch_field() is retrieved.

返回值

Returns an object containing field information, or FALSE on errors.

The properties of the object are:

  • name - column name
  • table - name of the table the column belongs to
  • max_length - maximum length of the column
  • not_null - 1 if the column cannot be NULL
  • type - the type of the column

范例

Example #1 fbsql_fetch_field() example

<?php
fbsql_connect
($host$user$password)
    or die(
"Could not connect");
$result fbsql_db_query("database""select * from table")
    or die(
"Query failed");
# get column metadata
$i 0;
while (
$i fbsql_num_fields($result)) {
    echo 
"Information for column $i:<br />\n";
    
$meta fbsql_fetch_field($result);
    if (!
$meta) {
        echo 
"No information available<br />\n";
    }
    echo 
"<pre>
max_length:   
$meta->max_length
name:         
$meta->name
not_null:     
$meta->not_null
table:        
$meta->table
type:         
$meta->type
</pre>"
;
    
$i++;
}
fbsql_free_result($result);
?>

参见

相关文章
php apc 函数 retrieves cached information from apc s data storephp apcu 函数 retrieves cached information from apcu s data storephp cubrid mysql 兼容性函数 get column information from a result and return as an objectphp cubrid mysql 兼容性函数 return an array with the lengths of the values of each field from the current rowphp cubrid mysql 兼容性函数 return the number of columns in the result setphp ibm db2 函数 returns the position of the named column in a result setphp ibm db2 函数 returns a single column from a row in the result setphp frontbase 函数 get column information from a result and return as an objectphp frontbase 函数 fetch a result row as an objectphp ldap 函数 parse result object from an ldap extended operationphp ldap 函数 extract information from resultphp maxdb 函数 return the number of rows in statements result setphp oci8 函数 returns the next child statement resource from a parent statement resource that has oracle database 12c implicit result setsphp snmp 函数 return all objects including their respective object id within the specified onephp sqlite 函数 fetches a column from the current row of a result setphp sqlite 函数 fetches the current row from a result set as an arrayphp sqlite 函数 return an array of column types from a particular tablephp sqlite 函数 fetches the next row from a result set as an objectphp stream 函数 return a bucket object from the brigade for operating onphp sybase 函数 get field information from a result
关注编程学问公众号