What are the potential pitfalls when switching from mysql to mysqli in PHP?

When switching from mysql to mysqli in PHP, one potential pitfall is not updating the function calls and syntax to match the mysqli extension. This can lead to errors and unexpected behavior in your code. To solve this, make sure to update all mysql functions to their mysqli equivalents and ensure that the connection to the database is properly established using the mysqli functions.

// Before switching to mysqli
$link = mysql_connect('localhost', 'username', 'password');
mysql_select_db('database_name', $link);

// After switching to mysqli
$link = mysqli_connect('localhost', 'username', 'password', 'database_name');
if (!$link) {
    die('Could not connect: ' . mysqli_connect_error());
}