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