1--TEST-- 2mysqli_field_tell() 3--EXTENSIONS-- 4mysqli 5--SKIPIF-- 6<?php 7require_once('skipifconnectfailure.inc'); 8?> 9--FILE-- 10<?php 11 require_once("connect.inc"); 12 13 require('table.inc'); 14 if (!$res = mysqli_query($link, "SELECT id FROM test ORDER BY id LIMIT 1", MYSQLI_USE_RESULT)) { 15 printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 16 } 17 18 var_dump(mysqli_field_tell($res)); 19 var_dump(mysqli_field_tell($res)); 20 var_dump(mysqli_fetch_field($res)); 21 var_dump(mysqli_fetch_field($res)); 22 var_dump(mysqli_field_tell($res)); 23 24 try { 25 var_dump(mysqli_field_seek($res, 2)); 26 } catch (\ValueError $e) { 27 echo $e->getMessage() . \PHP_EOL; 28 } 29 var_dump(mysqli_field_tell($res)); 30 31 try { 32 var_dump(mysqli_field_seek($res, -1)); 33 } catch (\ValueError $e) { 34 echo $e->getMessage() . \PHP_EOL; 35 } 36 var_dump(mysqli_field_tell($res)); 37 38 var_dump(mysqli_field_seek($res, 0)); 39 var_dump(mysqli_field_tell($res)); 40 41 42 43 mysqli_free_result($res); 44 45 try { 46 mysqli_field_tell($res); 47 } catch (Error $exception) { 48 echo $exception->getMessage() . "\n"; 49 } 50 51 mysqli_close($link); 52 53 print "done!"; 54?> 55--CLEAN-- 56<?php 57 require_once("clean_table.inc"); 58?> 59--EXPECTF-- 60int(0) 61int(0) 62object(stdClass)#%d (13) { 63 ["name"]=> 64 string(2) "id" 65 ["orgname"]=> 66 string(2) "id" 67 ["table"]=> 68 string(4) "test" 69 ["orgtable"]=> 70 string(4) "test" 71 ["def"]=> 72 string(0) "" 73 ["db"]=> 74 string(%d) "%s" 75 ["catalog"]=> 76 string(%d) "%s" 77 ["max_length"]=> 78 int(0) 79 ["length"]=> 80 int(11) 81 ["charsetnr"]=> 82 int(63) 83 ["flags"]=> 84 int(49155) 85 ["type"]=> 86 int(3) 87 ["decimals"]=> 88 int(0) 89} 90bool(false) 91int(1) 92mysqli_field_seek(): Argument #2 ($index) must be less than the number of fields for this result set 93int(1) 94mysqli_field_seek(): Argument #2 ($index) must be greater than or equal to 0 95int(1) 96bool(true) 97int(0) 98mysqli_result object is already closed 99done! 100