abcdefgh
abcdefgh

Reputation: 151

Class mysqli not found

I have used mysqli to connect to the database in my application. It worked fine for a few days and suddenly it started showing the following error:

Fatal error: Class 'mysqli' not found

The line I used to connect to the database is:

 $link = new mysqli('localhost', 'uname', 'password', 'scripts');

Could you please tell me what might have gone wrong?

Upvotes: 5

Views: 18077

Answers (2)

Joren
Joren

Reputation: 3297

Well you need to have MySQLi installed before you can use it. Also you'll have to enable it (when installed) in your php.ini file.

You can test if you have it with this code:

if (!function_exists('mysqli_init') && !extension_loaded('mysqli')) {
    echo 'no mysqli :(';
} else {
    echo 'we gots it';
}

When you've done that, and there still is an error, please provide us with more details (OS, PHP version etc)

Upvotes: 2

Jordi Kroon
Jordi Kroon

Reputation: 2597

You have to enable mysqli extension in your php.ini

Just search for extension=php_mysqli.dll or somethig and remove the #

Upvotes: 2

Related Questions