1--TEST-- 2mysql_field_table() 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_table())) 16 printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); 17 18if (null !== ($tmp = @mysql_field_table($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 2", $link)) { 23 printf("[003] [%d] %s\n", mysql_errno($link), mysql_error($link)); 24} 25 26if (NULL !== ($tmp = mysql_field_table($res))) 27 printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); 28 29if (false !== ($tmp = mysql_field_table($res, -1))) 30 printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); 31 32var_dump(mysql_field_table($res, 0)); 33 34if (false !== ($tmp = mysql_field_table($res, 2))) 35 printf("[008] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); 36 37mysql_free_result($res); 38 39var_dump(mysql_field_table($res, 0)); 40 41mysql_close($link); 42print "done!"; 43?> 44--CLEAN-- 45<?php 46require_once("clean_table.inc"); 47?> 48--EXPECTF-- 49Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d 50 51Warning: mysql_field_table() expects exactly 2 parameters, 1 given in %s on line %d 52 53Warning: mysql_field_table(): Field -1 is invalid for MySQL result index %d in %s on line %d 54%unicode|string%(4) "test" 55 56Warning: mysql_field_table(): Field 2 is invalid for MySQL result index %d in %s on line %d 57 58Warning: mysql_field_table(): %d is not a valid MySQL result resource in %s on line %d 59bool(false) 60done! 61