user3416503
user3416503

Reputation: 1

can't connect db with xampp

in dbconect

 <?php
$con = mysqli_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);

if (mysqli_connect_errno()) {
    echo " can't connect : " . mysqli_connect_error();
    exit;   
}
?>

and in dbconfig

<?php
define('DB_HOST', "localhost");
define('DB_USER', "root");
define('DB_PASS', "");
define('DB_NAME', "carwash");
define('DB_PREFIX', "carwash_");
?>

and output

Warning: mysqli_connect() [function.mysqli-connect]: (42000/1049): Unknown database 'carwash' in C:\xampp\htdocs\carwash\includes\dbconnect.php on line 2
can't connect : Unknown database 'carwash'

I don't know what's wrong or what's happened, it happen only today but the day pass it didn't happen

Upvotes: 0

Views: 593

Answers (1)

Swaraj Giri
Swaraj Giri

Reputation: 4037

Make sure you have a database named carwash.

Xampp comes with phpmyadmin,have a look for the databases you have there.

Upvotes: 1

Related Questions