I have imported the database into my php admin but the problem still exists:
Fatal error: Uncaught mysqli_sql_Exception: Unknown database 'bsmn' in C:xampphtdocsbsmnconnection.php:8 Stack trace: #0 C:xampphtdocsbsmnconnection.php(8): mysqli_connect('localhost', 'root', '', 'bsmn') #1 C:xampphtdocsbsmnindex.php(4): include('C:xampphtdocs...') # 2 {main} throws in C:xampphtdocsbsmnconnection.php on line 8 This is line 8 > if(!$con = mysqli_connect($dbhost,$dbuser,$dbpass,$dbname)) This file connection.php
<?php $dbhost = "localhost"; $dbuser = "root"; $dbpass = ""; $dbname = "bsmn"; if(!$con = mysqli_connect($dbhost,$dbuser,$dbpass,$dbname)) { die("failed to connect!"); }
P粉1279012792023-10-25 09:00:32
means you don't have a database named bsmn, if you use phpmyadmin find the database on the left and make sure it matches the database in your code above.
$dbname = "bsmn"; //This is looking for a database of the same name
Navigate to PhpMyadmin and check the left side as shown in the image below, you will see which databases you can connect to, if "bsmn" is not in the list, it does not exist.
Maybe you are looking for a table called "bsmn" but this will be in the database and you will need that database name.