What are the common issues when upgrading from PHP4 to PHP5, specifically regarding MySQL connectivity?
When upgrading from PHP4 to PHP5, one common issue with MySQL connectivity is the deprecated use of the `mysql_` functions in PHP5. To solve this, you should switch to using the `mysqli` or `PDO` extension for connecting to MySQL databases in PHP5.
// Using mysqli extension for MySQL connectivity in PHP5
$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";