mysqli next result - 语法

bool mysqli_next_result ( mysqli $link );

它从mysqli_multi_query()准备下一个输出集。

Sr.No 参数 & Description
1

link

它指定要使用的MySQL连接

mysqli next result - 返回值

成功时返回TRUE,失败时返回FALSE。

mysqli next result - 示例

<?php
   $connection_mysql=mysqli_connect("localhost","user","password","db");
   
   if (mysqli_connect_errno($connection_mysql)){
      echo "Failed to connect to MySQL: " . mysqli_connect_error();
   }
   $sql="SELECT name FROM emp;SELECT Country FROM emp";
   
   if (mysqli_multi_query($connection_mysql,$sql)){
      do{
         if ($result=mysqli_store_result($connection_mysql)){
            while ($row=mysqli_fetch_row($result)){
               print $row[0];
               print "\n";
            }
         }
      }while (mysqli_next_result($connection_mysql));
   }
   mysqli_close($connection_mysql);
?>

参考链接

https://www.learnfk.com/php/php-mysqli-next-result.html