1--TEST-- 2mysqli_errno() 3--EXTENSIONS-- 4mysqli 5--SKIPIF-- 6<?php 7require_once('skipifconnectfailure.inc'); 8?> 9--FILE-- 10<?php 11 require_once("connect.inc"); 12 13 if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { 14 printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", 15 $host, $user, $db, $port, $socket); 16} 17 18 var_dump(mysqli_errno($link)); 19 20 if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) { 21 printf("[004] Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 22 } 23 24 mysqli_query($link, 'SELECT * FROM test'); 25 var_dump(mysqli_errno($link)); 26 27 @mysqli_query($link, 'No SQL'); 28 if (($tmp = mysqli_errno($link)) == 0) 29 printf("[005] Expecting int/any non zero got %s/%s\n", gettype($tmp), $tmp); 30 31 mysqli_close($link); 32 33 try { 34 mysqli_errno($link); 35 } catch (Error $exception) { 36 echo $exception->getMessage() . "\n"; 37 } 38 39 print "done!"; 40?> 41--EXPECTF-- 42int(0) 43int(%d) 44mysqli object is already closed 45done! 46