1--TEST-- 2odbc_field_name(): Getting the name of the field 3--EXTENSIONS-- 4odbc 5--SKIPIF-- 6<?php include 'skipif.inc'; ?> 7--FILE-- 8<?php 9 10include 'config.inc'; 11 12$conn = odbc_connect($dsn, $user, $pass); 13 14odbc_exec($conn, 'CREATE TABLE field_name (foo INT, bar INT, baz INT)'); 15 16$res = odbc_exec($conn, 'SELECT * FROM field_name'); 17try { 18 odbc_field_name($res, 0); 19} catch (ValueError $error) { 20 echo $error->getMessage() . "\n"; 21} 22var_dump(odbc_field_name($res, 1)); 23var_dump(odbc_field_name($res, 2)); 24var_dump(odbc_field_name($res, 3)); 25var_dump(odbc_field_name($res, 4)); 26 27?> 28--CLEAN-- 29<?php 30require 'config.inc'; 31$conn = odbc_connect($dsn, $user, $pass); 32odbc_exec($conn, 'DROP TABLE field_name'); 33?> 34--EXPECTF-- 35odbc_field_name(): Argument #2 ($field) must be greater than 0 36string(3) "foo" 37string(3) "bar" 38string(3) "baz" 39 40Warning: odbc_field_name(): Field index larger than number of fields in %s on line %d 41bool(false) 42