PhpDig.net

What is PhpDig?
PhpDig is a PHP MySQL based
Web Spider & Search Engine.




ibase_field_info

Name

ibase_field_info — Fetch information about a field in a result set

Synopsis

array ibase_field_info(result, field);
resource result: Result set handle
int field: Field number in the result set

Returns

Array, or FALSE on error

Description

Returns an array with information about a field in result set after a SELECT query has been run, or FALSE if the field doesn't exist or an error occurred.

Elements of the returned array, both by index and name:

  • 0, name: Fields name in database.

  • 1, alias: Fields alias if you did a SELECT query like "select field_name as something_else ...", otherwise the same as name.

  • 2, relation: Databases name.

  • 3, length: Maximum size of data, in bytes, this field contains. Note that with datatypes other than CHAR or VARCHAR, this isnot the maximum number of characters needed to display it, but the length of its' internal representation. BLOBs always return 8, and you should fetch information about them one-by-one using ibase_blob_info() .

  • 4, type: Fields' type, one of TEXT (= CHAR), VARYING (= VARCHAR), SHORT, LONG, FLOAT, DOUBLE, D_FLOAT, INT64, TIMESTAMP, DATE, TIME, BLOB, ARRAY, QUAD, unknown.



Note

Available in PHP 3 since 3.0.7, PHP 4 since 4.0RC1

Example

Example 543. Retrieving field information

$db = ibase_connect('/opt/interbase/examples/employee.gdb') or die("Couldn't connect to database!");
$rs = ibase_query($db, 'select * from job');
$fields = ibase_num_fields($rs);
for ($i = 0; $i < $fields; $i++) {
    $row = ibase_field_info($rs, $i);
    print $row['name'] . "\n";
    print $row['alias'] . "\n";
    print $row['relation'] . "\n";
    print $row['length'] . "\n";
    print $row['type'] . "\n";
}



PHP Functions Essential Reference. Copyright © 2002 by New Riders Publishing (Authors: Zak Greant, Graeme Merrall, Torben Wilson, Brett Michlitsch). This material may be distributed only subject to the terms and conditions set forth in the Open Publication License, v1.0 or later (the latest version is presently available at http://www.opencontent.org/openpub/). The authors of this book have elected not to choose any options under the OPL. This online book was obtained from http://www.fooassociates.com/phpfer/ and is designed to provide information about the PHP programming language, focusing on PHP version 4.0.4 for the most part. The information is provided on an as-is basis, and no warranty or fitness is implied. All persons and entities shall have neither liability nor responsibility to any person or entity with respect to any loss or damage arising from the information contained in this book.

Powered by: vBulletin Version 3.0.7
Copyright ©2000 - 2005, Jelsoft Enterprises Ltd.
Copyright © 2001 - 2005, ThinkDing LLC. All Rights Reserved.