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