fbsql_fetch_field
(PHP 4 >= 4.0.6, PHP 5, PHP 7)
fbsql_fetch_field — Get column information from a result and return as an object
Description
$result
[, int $field_offset
] ) : objectUsed in order to obtain information about fields in a certain query result.
Parameters
-
result
-
A result identifier returned by fbsql_query() or 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.
Return Values
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
Examples
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);
?>
English translation
You have asked to visit this site in English. For now, only the interface is translated, but not all the content yet.If you want to help me in translations, your contribution is welcome. All you need to do is register on the site, and send me a message asking me to add you to the group of translators, which will give you the opportunity to translate the pages you want. A link at the bottom of each translated page indicates that you are the translator, and has a link to your profile.
Thank you in advance.
Document created the 30/01/2003, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/php-rf-function.fbsql-fetch-field.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.
References
These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.