1--TEST--
2mysqli bind_result 1
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
16mysqli_query(
17    $link,
18    "CREATE TABLE test_bind_fetch_varied(
19        col1 tinyint, col2 smallint,
20        col3 int, col4 bigint,
21        col5 float, col6 double,
22        col7 date, col8 time,
23        col9 varbinary(10),
24        col10 varchar(50),
25        col11 char(20),
26        col12 char(3) DEFAULT NULL
27    ) ENGINE=" . get_default_db_engine()
28);
29
30mysqli_query($link, "INSERT INTO test_bind_fetch_varied
31    VALUES(1, 2, 3, 4, 5.1, 6.2, '2020-02-21', '11:04', '111', 'foo1', 1000, null)");
32
33$stmt = mysqli_prepare($link, "SELECT col1, col2, col3, col4, col5, col6, col7, col8, col9, col10, col11, col12 from test_bind_fetch_varied ORDER BY col1");
34mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8, $c9, $c10, $c11, $c12);
35mysqli_stmt_execute($stmt);
36
37mysqli_stmt_fetch($stmt);
38
39$test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8,$c9,$c10,$c11,$c12);
40
41var_dump($test);
42
43mysqli_stmt_close($stmt);
44mysqli_close($link);
45print "done!";
46?>
47--CLEAN--
48<?php
49require_once dirname(__DIR__) . "/test_setup/test_helpers.inc";
50tear_down_table_on_default_connection('test_bind_fetch_varied');
51?>
52--EXPECT--
53array(12) {
54  [0]=>
55  int(1)
56  [1]=>
57  int(2)
58  [2]=>
59  int(3)
60  [3]=>
61  int(4)
62  [4]=>
63  float(5.1)
64  [5]=>
65  float(6.2)
66  [6]=>
67  string(10) "2020-02-21"
68  [7]=>
69  string(8) "11:04:00"
70  [8]=>
71  string(3) "111"
72  [9]=>
73  string(4) "foo1"
74  [10]=>
75  string(4) "1000"
76  [11]=>
77  NULL
78}
79done!
80