1--TEST--
2odbc_num_fields(): Getting the number of fields
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 num_fields (foo INT, bar INT, baz INT)');
15odbc_exec($conn, 'INSERT INTO num_fields VALUES (1, 2, 3)');
16
17$res = odbc_exec($conn, 'SELECT * FROM num_fields');
18var_dump(odbc_num_fields($res));
19odbc_free_result($res);
20
21$res = odbc_exec($conn, 'SELECT * FROM num_fields WHERE foo = 4');
22var_dump(odbc_num_fields($res));
23odbc_free_result($res);
24
25odbc_close($conn);
26?>
27--CLEAN--
28<?php
29require 'config.inc';
30$conn = odbc_connect($dsn, $user, $pass);
31odbc_exec($conn, 'DROP TABLE num_fields');
32?>
33--EXPECT--
34int(3)
35int(3)
36