1--TEST-- 2mysqli_use_result() 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_use_result())) 17 printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); 18 19 if (!is_null($tmp = @mysqli_use_result($link))) 20 printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); 21 22 require('table.inc'); 23 24 if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id")) 25 printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 26 27 if (!is_object($res = mysqli_use_result($link))) 28 printf("[004] Expecting object, got %s/%s. [%d] %s\n", 29 gettype($res), $res, mysqli_errno($link), mysqli_error($link)); 30 31 if (false !== ($tmp = mysqli_data_seek($res, 2))) 32 printf("[005] Expecting boolean/true, got %s/%s. [%d] %s\n", 33 gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link)); 34 35 mysqli_free_result($res); 36 37 if (!mysqli_query($link, "DELETE FROM test")) 38 printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 39 40 if (false !== ($res = mysqli_use_result($link))) 41 printf("[007] Expecting boolean/false, got %s/%s. [%d] %s\n", 42 gettype($res), $res, mysqli_errno($link), mysqli_error($link)); 43 44 if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id")) 45 printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 46 47 if (false !== ($tmp = mysqli_data_seek($res, 1))) 48 printf("[009] Expecting boolean/false, got %s/%s\n", 49 gettype($tmp), $tmp); 50 51 mysqli_close($link); 52 53 if (NULL !== ($tmp = mysqli_use_result($link))) 54 printf("[010] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); 55 56 print "done!"; 57?> 58--CLEAN-- 59<?php 60 require_once("clean_table.inc"); 61?> 62--EXPECTF-- 63Warning: mysqli_data_seek(): Function cannot be used with MYSQL_USE_RESULT in %s on line %d 64 65Warning: mysqli_use_result(): Couldn't fetch mysqli in %s on line %d 66done! 67