tags:

views:

58

answers:

3
Fatal error: Class 'MySQLi' not found in D:\Hosting\6448289\html\database.php on line 8

database.phph file -

<?php

$db_name = "szdb";
$db_server = "localhost";
$db_user = "root";
$db_pass = "";

$mysqli = new MySQLi($db_server, $db_user, $db_pass, $db_name) or die(mysqli_error());


?>

why I am getting this fetal error?

A: 

try write mysqli in lowercase

$mysqli = new mysqli($db_server, $db_user, $db_pass, $db_name) or die(mysqli_error());
Codler
+6  A: 

You need to install MySQLi, possibly.

Have you checked your phpinfo()?

Russell Dias
A: 

The problem is that you must use lowercase for mysqli keyword. Use this:

$db_name = "szdb";
$db_server = "localhost";
$db_user = "root";
$db_pass = "";
$mysqli = new mysqli($db_server, $db_user, $db_pass, $db_name) or die(mysqli_error());

This will do it.

shamittomar
Ummm... Class names are case insensitive... So no, that won't do it. If (As Russell Dias pointed out) the `MySQLi` class does not exist, the extension is not installed/loaded...
ircmaxell
OK. I agree. My bad.
shamittomar