1--TEST-- 2mysqli_use_result() 3--SKIPIF-- 4<?php 5require_once('skipif.inc'); 6require_once('skipifconnectfailure.inc'); 7?> 8--FILE-- 9<?php 10 require_once("connect.inc"); 11 12 require('table.inc'); 13 14 if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id")) 15 printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 16 17 if (!is_object($res = mysqli_use_result($link))) 18 printf("[004] Expecting object, got %s/%s. [%d] %s\n", 19 gettype($res), $res, mysqli_errno($link), mysqli_error($link)); 20 21 try { 22 var_dump(mysqli_data_seek($res, 2)); 23 } catch (\Error $e) { 24 echo $e->getMessage() . \PHP_EOL; 25 } 26 27 mysqli_free_result($res); 28 29 if (!mysqli_query($link, "DELETE FROM test")) 30 printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 31 32 if (false !== ($res = mysqli_use_result($link))) 33 printf("[007] Expecting boolean/false, got %s/%s. [%d] %s\n", 34 gettype($res), $res, mysqli_errno($link), mysqli_error($link)); 35 36 if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id")) 37 printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 38 39 if (false !== ($tmp = mysqli_data_seek($res, 1))) 40 printf("[009] Expecting boolean/false, got %s/%s\n", 41 gettype($tmp), $tmp); 42 43 mysqli_close($link); 44 45 try { 46 mysqli_use_result($link); 47 } catch (Error $exception) { 48 echo $exception->getMessage() . "\n"; 49 } 50 51 print "done!"; 52?> 53--CLEAN-- 54<?php 55 require_once("clean_table.inc"); 56?> 57--EXPECT-- 58mysqli_data_seek() cannot be used in MYSQLI_USE_RESULT mode 59mysqli object is already closed 60done! 61