Home php Uncaught Error: Call to Undefined Function MySQL_CONNECT ()

Uncaught Error: Call to Undefined Function MySQL_CONNECT ()




1) PHP7 Unpacked to the folder C: \ Apps \ PHP7 . I can not start the following script:

& lt;? php
$ link = mysql_connect ("LocalHost", "qwe", "qwe");
? & gt;

I get a mistake:

Fatal Error: Uncaught Error: Call to undefined Function MySQL_CONNECT ()

As I understood the problem is that the extension for MySQL is not loaded. But to download it, you need to revive the corresponding string in the PHP.ini file. But I could not find such a file.

2) I tried to do the following.

& lt;? php
DL ('php_mysqli.dll');
$ link = mysql_connect ("localhost", "root", "root");
? & gt;

But again got a mistake:

warning: php startup: unable to load dynamic library 'c: \ php \ php_mysqli.dll'

Apparently PHP Looking for an extension is not where it is necessary.

Help figure out.

Answer 1, Authority 100%

MySQL extension was recognized as obsolete since PHP 5.5.0 and completely removed in PHP version 7. It is time for you to go to more modern means of working with the base:

  • mysqli is a more modern version of the vendor-specific connector to MySQL. The functional interface of this library allows you to slightly smooth out the transition from MySQL on mysqli . Most of the MYSQLI functions have signatures similar to the mysql feature (for example, mysqli_query and MySQL_Query ). However, I strongly recommend Use the object interface of this library.

  • pdo – library, which is a full-fledged OOP toolkit for Works with database. The interface of this library allows you to abstract from which exactly the base is work. (Although the differences in SQL syntax will still remain.)

As a supplement, I will give link to another question dedicated to PDO and MYSQLI.

Answer 2

Make sure whether the path is correct to extension_dir in php.ini .

In this directory, php_mysqli.dll Ext Folder Root PHP .

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions