Are there any specific considerations to keep in mind when migrating a website from using global variables to mysqli in PHP?

When migrating a website from using global variables to mysqli in PHP, it's important to ensure that all database interactions are done using prepared statements to prevent SQL injection attacks. Additionally, you'll need to update all instances of global variables that were used to store database connection information with mysqli object-oriented or procedural functions.

// Before migration using global variables
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "myDB";

// After migration using mysqli
$mysqli = new mysqli("localhost", "root", "", "myDB");
if ($mysqli->connect_error) {
    die("Connection failed: " . $mysqli->connect_error);
}