1--TEST--
2mysqli_sqlstate()
3--SKIPIF--
4<?php
5require_once('skipif.inc');
6require_once('skipifconnectfailure.inc');
7?>
8--FILE--
9<?php
10    require_once("connect.inc");
11
12    require('table.inc');
13
14    var_dump(mysqli_sqlstate($link));
15    mysqli_query($link, "SELECT unknown_column FROM test");
16    var_dump(mysqli_sqlstate($link));
17    mysqli_free_result(mysqli_query($link, "SELECT id FROM test"));
18    var_dump(mysqli_sqlstate($link));
19
20    mysqli_close($link);
21
22    try {
23        mysqli_sqlstate($link);
24    } catch (Error $exception) {
25        echo $exception->getMessage() . "\n";
26    }
27
28    print "done!";
29?>
30--CLEAN--
31<?php
32    require_once("clean_table.inc");
33?>
34--EXPECTF--
35%s(5) "00000"
36%s(5) "42S22"
37%s(5) "00000"
38mysqli object is already closed
39done!
40