What does the error "Deprecated: mysql_connect()" in PHP indicate?

The error "Deprecated: mysql_connect()" in PHP indicates that the mysql_connect() function is no longer recommended for use as it has been deprecated in newer versions of PHP. To solve this issue, you should switch to using MySQLi or PDO extensions for connecting to a MySQL database, as they offer more features and are more secure.

// Connect to MySQL database using MySQLi
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "database";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);

// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully";