1--TEST-- 2mysqli_sqlstate() 3--SKIPIF-- 4<?php 5require_once('skipif.inc'); 6require_once('skipifemb.inc'); 7require_once('skipifconnectfailure.inc'); 8?> 9--FILE-- 10<?php 11 require_once("connect.inc"); 12 13 $tmp = NULL; 14 $link = NULL; 15 16 if (!is_null($tmp = @mysqli_sqlstate())) 17 printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); 18 19 if (!is_null($tmp = @mysqli_sqlstate($link))) 20 printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); 21 22 require('table.inc'); 23 24 var_dump(@mysqli_sqlstate($link, "foo")); 25 26 var_dump(mysqli_sqlstate($link)); 27 mysqli_query($link, "SELECT unknown_column FROM test"); 28 var_dump(mysqli_sqlstate($link)); 29 mysqli_free_result(mysqli_query($link, "SELECT id FROM test")); 30 var_dump(mysqli_sqlstate($link)); 31 32 mysqli_close($link); 33 34 var_dump(mysqli_sqlstate($link)); 35 36 print "done!"; 37?> 38--CLEAN-- 39<?php 40 require_once("clean_table.inc"); 41?> 42--EXPECTF-- 43NULL 44%s(5) "00000" 45%s(5) "42S22" 46%s(5) "00000" 47 48Warning: mysqli_sqlstate(): Couldn't fetch mysqli in %s on line %d 49NULL 50done!