query(„SET @a:=1“); $mysqli->change_user(„my_user“, „my_password“, „world“); $result = $mysqli->query(„SELECT DATABASE()“); $row = $result->fetch_row(); printf(„Default database: %sn“, $row[0]); $result = $mysqli->query(„SELECT @a“); $row = $result->fetch_row(); if ($row[0] === null) { printf(„Value of variable a is NULLn“); } The above examples will output:
Default database: world Value of variable a is NULL