What are the potential pitfalls when upgrading from PHP 5.6 to PHP 7.0 in terms of database queries?

When upgrading from PHP 5.6 to PHP 7.0, one potential pitfall with database queries is the deprecated use of the original MySQL extension, which has been removed in PHP 7.0. To solve this issue, you should update your database queries to use either MySQLi or PDO extensions, which are supported in PHP 7.0.

// Connect to MySQL using MySQLi extension
$mysqli = new mysqli('localhost', 'username', 'password', 'database');

// Check connection
if ($mysqli->connect_error) {
    die("Connection failed: " . $mysqli->connect_error);
}

// Perform a query
$result = $mysqli->query("SELECT * FROM table");

// Fetch data
while ($row = $result->fetch_assoc()) {
    // Process data
}

// Close connection
$mysqli->close();