1--TEST--
2odbc_num_rows(): Getting the number of rows
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_rows (test INT)');
15odbc_exec($conn, 'INSERT INTO num_rows VALUES (1), (2), (3)');
16
17$res = odbc_exec($conn, 'SELECT * FROM num_rows');
18var_dump(odbc_num_rows($res));
19odbc_free_result($res);
20
21$res = odbc_exec($conn, 'SELECT * FROM num_rows WHERE test = 4');
22var_dump(odbc_num_rows($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_rows');
32?>
33--EXPECT--
34int(3)
35int(0)
36