1--TEST--
2function test: mysqli_num_rows()
3--EXTENSIONS--
4mysqli
5--SKIPIF--
6<?php
7require_once dirname(__DIR__) . "/test_setup/test_helpers.inc";
8mysqli_check_skip_test();
9?>
10--FILE--
11<?php
12require_once dirname(__DIR__) . "/test_setup/test_helpers.inc";
13
14    $link = default_mysqli_connect();
15
16    mysqli_query($link, "CREATE TABLE test_mysqli_num_rows (a int, b varchar(10)) ENGINE=" . get_default_db_engine());
17    mysqli_query($link, "INSERT INTO test_mysqli_num_rows VALUES (1, 'foo')");
18
19    mysqli_real_query($link, "SELECT * FROM test_mysqli_num_rows");
20    if (mysqli_field_count($link)) {
21        $result = mysqli_store_result($link);
22        $num = mysqli_num_rows($result);
23        mysqli_free_result($result);
24    }
25
26    var_dump($num);
27
28    mysqli_close($link);
29    print "done!";
30?>
31--CLEAN--
32<?php
33require_once dirname(__DIR__) . "/test_setup/test_helpers.inc";
34tear_down_table_on_default_connection('test_mysqli_num_rows');
35?>
36--EXPECT--
37int(1)
38done!
39