Undefined function mysql_connect()
Well, this is your chance! It looks like PDO is ready; use that instead.
Try checking to see if the PHP MySQL extension module is being loaded:
<?php
phpinfo();
?>
If it's not there, add the following to the php.ini
file:
extension=php_mysql.dll
Fatal error: Uncaught Error: Call to undefined function mysql_connect()
mysql_*
functions have been removed in PHP 7.
You probably have PHP 7 in XAMPP. You now have two alternatives: MySQLi and PDO.
PHP Fatal error : Call to undefined function mysql_connect()
To correct the error, you've basically got two choices, either
1) modify the code to remove references to the mysql extension (and use mysqli or PDO instead), or
2) install an older version of PHP (before PHP7) which supports the mysql extension
FOLLOWUP:
If what you claim is true... that mysql_
functions are working under PHP7, then the most likely explanation for that is that someone installed a third party module/library that exports mysql_
functions.
I believe there was some work done to build such a library, to provide backwards compatiblity. The library would interact with the database using using the newer PHP mysqli_
functions, and provide (mostly) compatible mysql_
functions for legacy applications.
But that's not part of PHP7. That would be a third party add on.
PHP : Undefined function mysql_connect()
mysql_connect()
has been removed from PHP7, which is used by the newest xampp version.
Instead, use mysqli_connect() like in this example.
Another method, PDO is also possible (but is coded in a very different way as mysql_connect.)
Uncaught Error: Call to undefined function mysql_connect() - WordPress Setup
I found the solution, All you have to do is uncomment these lines in php.ini
extension=mysqli
extension=pdo_mysql
Related Topics
Simplest Two-Way Encryption Using PHP
How to Remove "Index.PHP" in Codeigniter'S Path
How to Encrypt/Decrypt Data in PHP
Calling Closure Assigned to Object Property Directly
How to Mathematically Evaluate a String Like "2-1" to Produce "1"
Make All Words Lowercase and the First Letter of Each Word Uppercase
Https and Ssl3_Get_Server_Certificate:Certificate Verify Failed, Ca Is Ok
Displaying HTML With Blade Shows the HTML Code
PHP Regular Expressions: No Ending Delimiter '^' Found In
Comparing String to Integer Gives Strange Results