Fatal error: Uncaught error: Call to undefined function mysql_connect() : Fatal error: Uncaught error: Call to undefined function mysql_connect() when connecting to the database using PHP validation code. This is because the version of PHP you are using does not support the older version of join statement writing. The PHP version used in this study is PHP-7.4.2-NTS-Win32-VC15-x64, and the verification code is:
< ?PHP
the mysql_connect (‘ 127.0.0.1 ‘, ‘runner_db_user’, ‘runner_db_password’)
the OR die (” Could not connect to the database. ‘);
the mysql_select_db (‘ hfjq_race_info ‘);
echo “Connected!” ;
?>
After inquiry, this writing method is the previous version of 5. X, the following code is as follows:
< ?php
$con=mysqli_connect(“127.0.0.1”, “runner_db_user”, “hfjq_race_info”)
OR die(‘Could not connect to database.’);
echo “Connected!” ;
?>
You can connect to the database normally. If you have extension=mysqli, change the semicolon “;” before extension=mysqli. You can connect to the MySQL database normally if you remove it
< ?PHP
the mysql_connect (‘ 127.0.0.1 ‘, ‘runner_db_user’, ‘runner_db_password’)
the OR die (” Could not connect to the database. ‘);
the mysql_select_db (‘ hfjq_race_info ‘);
echo “Connected!” ;
?>
After inquiry, this writing method is the previous version of 5. X, the following code is as follows:
< ?php
$con=mysqli_connect(“127.0.0.1”, “runner_db_user”, “hfjq_race_info”)
OR die(‘Could not connect to database.’);
echo “Connected!” ;
?>
You can connect to the database normally. If you have extension=mysqli, change the semicolon “;” before extension=mysqli. You can connect to the MySQL database normally if you remove it
Read More:
- Fatal error: Uncaught Error: Call to undefined function mysql_connect()
- PHP connection to MySQL database error: call to undefined function MySQL_ connect()
- Uncaught error: call to undefined function MySQL when building sqli lab environment with phpstudy_ Connect() error
- Call to undefined function mysql_ Connect() solution summary
- Connection between PHP 7.4 and MySQL (MariaDB) under Ubuntu (kali Linux)
- node.js Server MySQL database connection timeout (error: connect etimeout)
- PHP connection PostgreSQL error call to undefined function PG_ connect()
- Call to undefined function oci_ Connect() problem solving
- Fatal error: Call to a member function bind_param() on a non-object in
- Linux GCC compilation error: “collect2: LD returned 1 exit status”
- Solution to MySQL Error 1130 problem
- php mysqli_ connect_ Error () and mysqli_ connect_ The difference of errno() function
- Host is not allowed to connect to this MySQL server
- After installing MySQL again under Linux, the solution of ‘MySQL module failed to start’ appears
- How to view the version of MySQL database
- C ා connect mysql: fatal error encountered during command execution solution
- Solve MySQL error 1698 (28000): access denied for user ‘root’ @’localhost ‘
- MySQL startup problem (ERROR 1045 (28000): Access denied for user’ODBC’@’localhost’ (using password: NO))
- Wamp install WordPress prompt can’t select database
- Error warning: mysqli_ error() expects parameter 1 to be mysqli, null given。 Any idea why?