1--TEST-- 2mysqli_more_results() 3--SKIPIF-- 4<?php 5require_once('skipif.inc'); 6require_once('skipifconnectfailure.inc'); 7?> 8--FILE-- 9<?php 10 require_once("connect.inc"); 11 12 require('table.inc'); 13 14 print "[004]\n"; 15 var_dump(mysqli_more_results($link)); 16 17 if (!mysqli_multi_query($link, "SELECT 1 AS a; SELECT 1 AS a, 2 AS b; SELECT id FROM test ORDER BY id LIMIT 3")) 18 printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 19 print "[006]\n"; 20 $i = 1; 21 22 if (mysqli_get_server_version($link) > 41000 && !($ret = mysqli_more_results($link))) 23 printf("[007] Expecting boolean/true, got %s/%s\n", gettype($ret), $ret); 24 do { 25 $res = mysqli_store_result($link); 26 mysqli_free_result($res); 27 if (mysqli_more_results($link)) 28 printf("%d\n", $i++); 29 } while (mysqli_next_result($link)); 30 31 if (!mysqli_multi_query($link, "SELECT 1 AS a; SELECT 1 AS a, 2 AS b; SELECT id FROM test ORDER BY id LIMIT 3")) 32 printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 33 print "[010]\n"; 34 $i = 1; 35 if (mysqli_get_server_version($link) > 41000 && !($ret = mysqli_more_results($link))) 36 printf("[011] Expecting boolean/true, got %s/%s\n", gettype($ret), $ret); 37 38 do { 39 $res = mysqli_use_result($link); 40 // NOTE: if you use mysqli_use_result() with mysqli_more_results() or any other info function, 41 // you must fetch all rows before you can loop to the next result set! 42 // See also the MySQL Reference Manual: mysql_use_result() 43 while ($row = mysqli_fetch_array($res)) 44 ; 45 mysqli_free_result($res); 46 if (mysqli_more_results($link)) 47 printf("%d\n", $i++); 48 } while (mysqli_next_result($link)); 49 50 mysqli_close($link); 51 52 try { 53 mysqli_more_results($link); 54 } catch (Error $exception) { 55 echo $exception->getMessage() . "\n"; 56 } 57 58 print "done!"; 59?> 60--CLEAN-- 61<?php 62 require_once("clean_table.inc"); 63?> 64--EXPECT-- 65[004] 66bool(false) 67[006] 681 692 70[010] 711 722 73mysqli object is already closed 74done! 75