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