我有那个代码:
$mysqli = new mysqli($dbhost, $dbuser, $dbpass, $dbname);
$result = $mysqli->query("SELECT id FROM User");
echo("users: " . $result->num_rows ."<br/>");
function echoUserNum()
{
$result = $mysqli->query("SELECT id FROM User");
echo("users: " . $result->num_rows ."<br/>");
}
echoUserNum();
它只打印一次用户数(第一次回声呼叫)。问题出在哪里?