1--TEST--
2mysqli_stmt_prepare()
3--EXTENSIONS--
4mysqli
5--SKIPIF--
6<?php
7require_once 'skipifconnectfailure.inc';
8?>
9--FILE--
10<?php
11    // Note: No SQL tests here! We can expand one of the *fetch()
12    // tests to a generic SQL test, if we ever need that.
13    // We would duplicate the SQL test cases if we have it here and in one of the
14    // fetch tests, because the fetch tests would have to call prepare/execute etc.
15    // anyway.
16
17    require 'table.inc';
18
19    if (!$stmt = mysqli_stmt_init($link))
20        printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
21
22    if (false !== ($tmp = mysqli_stmt_prepare($stmt, '')))
23        printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
24
25    if (true !== ($tmp = mysqli_stmt_prepare($stmt, 'SELECT id FROM test')))
26        printf("[006] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
27
28    mysqli_stmt_close($stmt);
29
30    try {
31        mysqli_stmt_prepare($stmt, "SELECT id FROM test");
32    } catch (Error $exception) {
33        echo $exception->getMessage() . "\n";
34    }
35
36    mysqli_close($link);
37    print "done!";
38?>
39--CLEAN--
40<?php
41    require_once 'clean_table.inc';
42?>
43--EXPECT--
44mysqli_stmt object is already closed
45done!
46