1--TEST-- 2mysql_field_seek() 3--SKIPIF-- 4<?php 5require_once('skipif.inc'); 6require_once('skipifconnectfailure.inc'); 7?> 8--FILE-- 9<?php 10include "connect.inc"; 11 12$tmp = NULL; 13$link = NULL; 14 15if (!is_null($tmp = @mysql_field_seek())) 16 printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); 17 18if (!is_null($tmp = @mysql_field_seek($link))) 19 printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); 20 21require('table.inc'); 22if (!$res = mysql_query("SELECT id, label FROM test ORDER BY id LIMIT 1", $link)) { 23 printf("[003] [%d] %s\n", mysql_errno($link), mysql_error($link)); 24} 25 26var_dump(mysql_field_seek($res, -1)); 27var_dump(mysql_fetch_field($res)); 28var_dump(mysql_field_seek($res, 0)); 29var_dump(mysql_fetch_field($res)); 30var_dump(mysql_field_seek($res, 1)); 31var_dump(mysql_fetch_field($res)); 32var_dump(mysql_field_seek($res, 2)); 33var_dump(mysql_fetch_field($res)); 34 35mysql_free_result($res); 36 37var_dump(mysql_field_seek($res, 0)); 38 39mysql_close($link); 40print "done!"; 41?> 42--CLEAN-- 43<?php 44require_once("clean_table.inc"); 45?> 46--EXPECTF-- 47Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d 48 49Warning: mysql_field_seek(): Field -1 is invalid for MySQL result index %d in %s on line %d 50bool(false) 51object(stdClass)#%d (13) { 52 [%u|b%"name"]=> 53 %unicode|string%(2) "id" 54 [%u|b%"table"]=> 55 %unicode|string%(4) "test" 56 [%u|b%"def"]=> 57 %unicode|string%(0) "" 58 [%u|b%"max_length"]=> 59 int(1) 60 [%u|b%"not_null"]=> 61 int(1) 62 [%u|b%"primary_key"]=> 63 int(1) 64 [%u|b%"multiple_key"]=> 65 int(0) 66 [%u|b%"unique_key"]=> 67 int(0) 68 [%u|b%"numeric"]=> 69 int(1) 70 [%u|b%"blob"]=> 71 int(0) 72 [%u|b%"type"]=> 73 %unicode|string%(3) "int" 74 [%u|b%"unsigned"]=> 75 int(0) 76 [%u|b%"zerofill"]=> 77 int(0) 78} 79bool(true) 80object(stdClass)#%d (13) { 81 [%u|b%"name"]=> 82 %unicode|string%(2) "id" 83 [%u|b%"table"]=> 84 %unicode|string%(4) "test" 85 [%u|b%"def"]=> 86 %unicode|string%(0) "" 87 [%u|b%"max_length"]=> 88 int(1) 89 [%u|b%"not_null"]=> 90 int(1) 91 [%u|b%"primary_key"]=> 92 int(1) 93 [%u|b%"multiple_key"]=> 94 int(0) 95 [%u|b%"unique_key"]=> 96 int(0) 97 [%u|b%"numeric"]=> 98 int(1) 99 [%u|b%"blob"]=> 100 int(0) 101 [%u|b%"type"]=> 102 %unicode|string%(3) "int" 103 [%u|b%"unsigned"]=> 104 int(0) 105 [%u|b%"zerofill"]=> 106 int(0) 107} 108bool(true) 109object(stdClass)#%d (13) { 110 [%u|b%"name"]=> 111 %unicode|string%(5) "label" 112 [%u|b%"table"]=> 113 %unicode|string%(4) "test" 114 [%u|b%"def"]=> 115 %unicode|string%(0) "" 116 [%u|b%"max_length"]=> 117 int(1) 118 [%u|b%"not_null"]=> 119 int(0) 120 [%u|b%"primary_key"]=> 121 int(0) 122 [%u|b%"multiple_key"]=> 123 int(0) 124 [%u|b%"unique_key"]=> 125 int(0) 126 [%u|b%"numeric"]=> 127 int(0) 128 [%u|b%"blob"]=> 129 int(0) 130 [%u|b%"type"]=> 131 %unicode|string%(6) "string" 132 [%u|b%"unsigned"]=> 133 int(0) 134 [%u|b%"zerofill"]=> 135 int(0) 136} 137 138Warning: mysql_field_seek(): Field %d is invalid for MySQL result index %d in %s on line %d 139bool(false) 140bool(false) 141 142Warning: mysql_field_seek(): %d is not a valid MySQL result resource in %s on line %d 143bool(false) 144done! 145