-2

这条线的作用/目的是什么:

$db->next_result();

如果我删除该行,我会得到相同的输出/结果。

<?php
$mysqli = new mysqli("localhost", "user", "pass", "db");

/* check connection */
if ($mysqli->connect_errno) {
    printf("Connect failed: %s\n", $mysqli->connect_error);
    exit();
}

if ($result=$mysqli->query("SELECT * FROM `users`")) {
    printf("Successfully queried.\n");
}

if($result){

    while ($row=$result->fetch_object()){
        print_r($row);
    }

    // Free result set
    $result->close();
    $db->next_result();

}

else echo($db->error);

$mysqli->close();

?>
4

1 回答 1

0

来自php文档

mysqli::next_result -- mysqli_next_result — Prepare next result from multi_query
于 2013-03-16T12:54:06.817 回答