I have that code:
$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();
It prints the number of users only once (first echo call). Where is the problem?