Are there any best practices for updating PHP scripts from MySQL to MySQLi?

When updating PHP scripts from MySQL to MySQLi, it is important to replace the deprecated MySQL functions with their MySQLi equivalents. This includes changing functions like mysql_connect() to mysqli_connect(), mysql_query() to mysqli_query(), and mysql_fetch_array() to mysqli_fetch_array(). Additionally, make sure to update the connection parameters and error handling to align with MySQLi standards.

// Before updating PHP script from MySQL to MySQLi
$conn = mysql_connect($servername, $username, $password);
mysql_select_db($dbname);

$result = mysql_query("SELECT * FROM table");

while($row = mysql_fetch_array($result)) {
    echo $row['column'];
}

// After updating PHP script to MySQLi
$conn = mysqli_connect($servername, $username, $password, $dbname);

$result = mysqli_query($conn, "SELECT * FROM table");

while($row = mysqli_fetch_array($result)) {
    echo $row['column'];
}