1--TEST-- 2mysqli_next_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_next_result())) 17 printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); 18 19 if (!is_null($tmp = @mysqli_next_result($link))) 20 printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); 21 22 require('table.inc'); 23 24 if (false !== ($tmp = mysqli_next_result($link))) 25 printf("[003] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); 26 27 $res = mysqli_query($link, "SELECT 1 AS res"); 28 if (false !== ($tmp = mysqli_next_result($link))) 29 printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); 30 31 mysqli_free_result($res); 32 33 function func_test_mysqli_next_result($link, $query, $offset, $num_results) { 34 35 if (!mysqli_multi_query($link, $query)) 36 printf("[%03d] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link)); 37 38 $i = 0; 39 do { 40 if ($res = mysqli_store_result($link)) { 41 mysqli_free_result($res); 42 $i++; 43 } 44 } while (true === mysqli_next_result($link)); 45 46 if ($i !== $num_results) { 47 printf("[%03d] Expecting %d result(s), got %d result(s)\n", $offset + 2, $num_results, $i); 48 } 49 50 if (mysqli_more_results($link)) 51 printf("[%03d] mysqli_more_results() indicates more results than expected\n", $offset + 3); 52 53 if (!($res = mysqli_query($link, "SELECT 1 AS b"))) { 54 printf("[%03d] [%d] %s\n", $offset + 4, mysqli_errno($link), mysqli_error($link)); 55 } else { 56 mysqli_free_result($res); 57 } 58 59 } 60 61 func_test_mysqli_next_result($link, "SELECT 1 AS a; SELECT 1 AS a, 2 AS b; SELECT id FROM test ORDER BY id LIMIT 3", 5, 3); 62 func_test_mysqli_next_result($link, "SELECT 1 AS a; INSERT INTO test(id, label) VALUES (100, 'y'); SELECT 1 AS a, 2 AS b", 8, 2); 63 func_test_mysqli_next_result($link, "DELETE FROM test WHERE id >= 100; SELECT 1 AS a; ", 11, 1); 64 65 mysqli_close($link); 66 67 var_dump(mysqli_next_result($link)); 68 69 print "done!"; 70?> 71--CLEAN-- 72<?php 73 require_once("clean_table.inc"); 74?> 75--EXPECTF-- 76Strict Standards: mysqli_next_result(): There is no next result set. Please, call mysqli_more_results()/mysqli::more_results() to check whether to call this function/method in %s on line %d 77 78Strict Standards: mysqli_next_result(): There is no next result set. Please, call mysqli_more_results()/mysqli::more_results() to check whether to call this function/method in %s on line %d 79 80Strict Standards: mysqli_next_result(): There is no next result set. Please, call mysqli_more_results()/mysqli::more_results() to check whether to call this function/method in %s on line %d 81 82Strict Standards: mysqli_next_result(): There is no next result set. Please, call mysqli_more_results()/mysqli::more_results() to check whether to call this function/method in %s on line %d 83 84Strict Standards: mysqli_next_result(): There is no next result set. Please, call mysqli_more_results()/mysqli::more_results() to check whether to call this function/method in %s on line %d 85 86Warning: mysqli_next_result(): Couldn't fetch mysqli in %s on line %d 87bool(false) 88done! 89