php database connection error is because PHP7.0 has abolished the "mysql_connect" function. The solution is to use the "mysqli_connect" function to connect to the database.
Recommended: "PHP Video Tutorial"
PHP Connection Database Error
Reason: PHP7.0 abolished the mysql_connect() function
Replacement function:
mysqli_connect();
Example:
<?PHP $conn=mysqli_connect("localhost","root","root"); if($conn){ echo"ok"; }else{ echo"error"; } ?>
The above is the detailed content of How to solve the problem of php database connection error. For more information, please follow other related articles on the PHP Chinese website!