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