// Database connection variables
$host = "localhost";
$username = "root"; //
$password = ""; //
$dbname = "php_pro"; //
// no 9 Create a new MySQLi connection
$conn = new mysqli("localhost", "root", "", "php_pro");
// Check if the connection was successful
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
The program yields ‘not able to connect to mysql’.
Fatal error: Uncaught Error: Class "mysqli" not found in C:\xampp\htdocs\php-project\database_connection.php:9 Stack trace: #0 {main} thrown in C:\xampp\htdocs\php-project\database_connection.php on line 9
I uncommented extension=mysql
in xampp already. info.php
says my sql is enabled, but the error persists.
You need to sign in to view this answers
Leave feedback about this