What are the potential pitfalls of using the outdated mysql_* functions in PHP?

Using the outdated mysql_* functions in PHP can pose security risks as they are vulnerable to SQL injection attacks and lack support for modern MySQL features. It is recommended to switch to MySQLi or PDO for improved security and functionality.

// Connect to MySQL using MySQLi
$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 results
while ($row = $result->fetch_assoc()) {
    echo $row['column'];
}

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