1--TEST--
2mysqli insert (bind_param + bind_result)
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(
17        $link,
18        "CREATE TABLE insert_bind_varied1(
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        ) ENGINE=" . get_default_db_engine()
27    );
28
29    $stmt = mysqli_prepare($link, "INSERT INTO insert_bind_varied1(col1,col10, col11, col6) VALUES (?,?,?,?)");
30
31    mysqli_stmt_bind_param($stmt, "issd", $c1, $c2, $c3, $c4);
32
33    $c1 = 1;
34    $c2 = "foo";
35    $c3 = "foobar";
36    $c4 = 3.14;
37
38    mysqli_stmt_execute($stmt);
39    mysqli_stmt_close($stmt);
40
41    $stmt = mysqli_prepare($link, "SELECT * FROM insert_bind_varied1");
42
43    mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8, $c9, $c10, $c11);
44    mysqli_stmt_execute($stmt);
45
46    mysqli_stmt_fetch($stmt);
47
48    $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8,$c9,$c10,$c11);
49
50    var_dump($test);
51
52    mysqli_stmt_close($stmt);
53    mysqli_close($link);
54    print "done!";
55?>
56--CLEAN--
57<?php
58require_once dirname(__DIR__) . "/test_setup/test_helpers.inc";
59tear_down_table_on_default_connection('insert_bind_varied1');
60?>
61--EXPECT--
62array(11) {
63  [0]=>
64  int(1)
65  [1]=>
66  NULL
67  [2]=>
68  NULL
69  [3]=>
70  NULL
71  [4]=>
72  NULL
73  [5]=>
74  float(3.14)
75  [6]=>
76  NULL
77  [7]=>
78  NULL
79  [8]=>
80  NULL
81  [9]=>
82  string(3) "foo"
83  [10]=>
84  string(6) "foobar"
85}
86done!
87