1--TEST--
2odbc_fetch_row(): Getting data from query
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 fetch_row (test INT)');
15
16odbc_exec($conn, 'INSERT INTO fetch_row VALUES (1), (2)');
17
18$res = odbc_exec($conn, 'SELECT * FROM fetch_row');
19
20var_dump(odbc_fetch_row($res, 0));
21
22var_dump(odbc_fetch_row($res, null));
23var_dump(odbc_result($res, 'test'));
24
25var_dump(odbc_fetch_row($res, null));
26var_dump(odbc_result($res, 'test'));
27
28var_dump(odbc_fetch_row($res, 2));
29var_dump(odbc_result($res, 'test'));
30
31var_dump(odbc_fetch_row($res, 4));
32
33odbc_free_result($res);
34odbc_close($conn);
35?>
36--CLEAN--
37<?php
38require 'config.inc';
39$conn = odbc_connect($dsn, $user, $pass);
40odbc_exec($conn, 'DROP TABLE fetch_row');
41?>
42--EXPECTF--
43Warning: odbc_fetch_row(): Argument #3 ($row) must be greater than or equal to 1 in %s on line %d
44bool(false)
45bool(true)
46string(1) "1"
47bool(true)
48string(1) "2"
49bool(true)
50string(1) "2"
51bool(false)
52