Fatal error: Uncaught Error: Call to undefined function mysql_connect()
Posted By: Anonymous
I am trying to do a simple connection with XAMPP and MySQL server, but whenever I try to enter data or connect to the database, I get this error.
Fatal error: Uncaught Error: Call to undefined function mysql_connect() in C:xampphtdocsregister.php:22
Stack trace: #0 {main} thrown in C:xampphtdocsregister.php on line 22
Example of line 22:
$link = mysql_connect($mysql_hostname , $mysql_username);
Solution
mysql_*
functions have been removed in PHP 7.
You probably have PHP 7 in XAMPP. You now have two alternatives: MySQLi and PDO.
Additionally, here is a nice wiki page about PDO.
Answered By: Anonymous
Disclaimer: This content is shared under creative common license cc-by-sa 3.0. It is generated from StackExchange Website Network.