Home >Database >Mysql Tutorial >Why is `mysql_connect()` causing a 'Fatal error' in PHP 7?
Error: "Fatal error: Uncaught Error: Call to undefined function mysql_connect() in register.php:22"
Question:
When attempting to establish a connection with the MySQL server, the following error is encountered:
Fatal error: Uncaught Error: Call to undefined function mysql_connect()
This error occurs specifically in line 22 of the register.php script:
$link = mysql_connect($mysql_hostname , $mysql_username);
Answer:
The mysql_* family of functions, including mysql_connect(), has been deprecated in PHP 7 and subsequently removed entirely. This means that PHP 7 no longer supports these functions.
Since XAMPP utilizes PHP 7, it is likely that you are facing this issue due to PHP 7 being active in your XAMPP installation.
To address this, you have two primary options:
The above is the detailed content of Why is `mysql_connect()` causing a 'Fatal error' in PHP 7?. For more information, please follow other related articles on the PHP Chinese website!