Deprecated Warning: mysql_connect()
Problem:
The MySQL code is triggering a deprecated warning, indicating that the mysql_connect() function is obsolete and will be removed in the future.
Solution:
To eliminate this warning, you have several options:
$connection = mysqli_connect('localhost', 'username', 'password', 'database');
$connection = new PDO('mysql:host=localhost;dbname=database', 'username', 'password');
error_reporting(E_ALL ^ E_DEPRECATED);
Specific File and Line Location for Error:
If you are receiving the exact error message "/System/Startup.php > line: 2 " error_reporting(E_All);", you can resolve it by replacing that line with the following:
error_reporting(E_ALL ^ E_DEPRECATED);
The above is the detailed content of How to Fix the Deprecated Warning: `mysql_connect()`?. For more information, please follow other related articles on the PHP Chinese website!