1--TEST-- 2mysqli_field_tell() 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_field_tell())) 17 printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); 18 19 if (!is_null($tmp = @mysqli_field_tell($link))) 20 printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); 21 22 require('table.inc'); 23 if (!$res = mysqli_query($link, "SELECT id FROM test ORDER BY id LIMIT 1", MYSQLI_USE_RESULT)) { 24 printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 25 } 26 27 var_dump(mysqli_field_tell($res)); 28 var_dump(mysqli_field_seek(1)); 29 var_dump(mysqli_field_tell($res)); 30 var_dump(mysqli_fetch_field($res)); 31 var_dump(mysqli_fetch_field($res)); 32 var_dump(mysqli_field_tell($res)); 33 34 if (!is_null($tmp = @mysqli_field_tell($res, 'too many arguments'))) 35 printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); 36 37 38 var_dump(mysqli_field_seek($res, 2)); 39 var_dump(mysqli_field_tell($res)); 40 41 var_dump(mysqli_field_seek($res, -1)); 42 var_dump(mysqli_field_tell($res)); 43 44 var_dump(mysqli_field_seek($res, 0)); 45 var_dump(mysqli_field_tell($res)); 46 47 48 49 mysqli_free_result($res); 50 51 var_dump(mysqli_field_tell($res)); 52 53 mysqli_close($link); 54 55 print "done!"; 56?> 57--CLEAN-- 58<?php 59 require_once("clean_table.inc"); 60?> 61--EXPECTF-- 62int(0) 63 64Warning: mysqli_field_seek() expects exactly 2 parameters, 1 given in %s on line %d 65NULL 66int(0) 67object(stdClass)#%d (13) { 68 [%u|b%"name"]=> 69 %unicode|string%(2) "id" 70 [%u|b%"orgname"]=> 71 %unicode|string%(2) "id" 72 [%u|b%"table"]=> 73 %unicode|string%(4) "test" 74 [%u|b%"orgtable"]=> 75 %unicode|string%(4) "test" 76 [%u|b%"def"]=> 77 %unicode|string%(0) "" 78 [%u|b%"db"]=> 79 %unicode|string%(%d) "%s" 80 [%u|b%"catalog"]=> 81 %unicode|string%(%d) "%s" 82 [%u|b%"max_length"]=> 83 int(0) 84 [%u|b%"length"]=> 85 int(11) 86 [%u|b%"charsetnr"]=> 87 int(63) 88 [%u|b%"flags"]=> 89 int(49155) 90 [%u|b%"type"]=> 91 int(3) 92 [%u|b%"decimals"]=> 93 int(0) 94} 95bool(false) 96int(1) 97 98Warning: mysqli_field_seek(): Invalid field offset in %s on line %d 99bool(false) 100int(1) 101 102Warning: mysqli_field_seek(): Invalid field offset in %s on line %d 103bool(false) 104int(1) 105bool(true) 106int(0) 107 108Warning: mysqli_field_tell(): Couldn't fetch mysqli_result in %s on line %d 109NULL 110done!