What are common pitfalls when transitioning from PHP 5 to PHP 7, especially with functions like mysql_query?

When transitioning from PHP 5 to PHP 7, a common pitfall is the use of deprecated functions like mysql_query, which has been removed in PHP 7. To solve this issue, you should switch to using the MySQLi or PDO extension for database queries.

// Before PHP 7
$result = mysql_query("SELECT * FROM table");

// After PHP 7
$conn = new mysqli($servername, $username, $password, $dbname);
$result = $conn->query("SELECT * FROM table");