Mistake :

Warning: mysqli_connect (): (HY000 / 1045): Access denied for user '' @ 'localhost' (using password: NO) in C: \ Users \ Filip \ Desktop \ OSPanel \ domains \ mynewchat.com \ configAndDb \ db. php on line 9

Config.php code:

<?php $config = array ( "title" => "Мой блог"; "db" => array ( "username" => "root", "server" => "localhost", "password" => "", "name" => "myportfolio" ) ) require "db.php"; ?> 

Code db.php:

 <?php $connection = mysqli_connect ( $config["db"]["user"], $config["db"]["username"], $config["db"]["server"], $config["db"]["password"] ) ?> 
  • Well, seriously - you do not see that you have two keys, user and username ? - u_mulder pm
  • Oh, inattention - Luric
  • u_mulder but it does not change the essence, the error is the same - Luric
  • What has changed in the code? - u_mulder pm
  • Is it really that important? Well, the user changed the name - Luric

1 answer 1

I have such a config and everything works. Maybe take yourself this? (There $ database and define change for your own, if you are going to take this option)

 <?php # Настройки: $host = 'localhost'; // Не меняй если локалка!!! Если не локалка, меняй на название своего хоста $database = 'physics'; // Название твоей БД, если нету, сделать!!! $dbUser = 'mysql'; // Логин, если не реестировался на phpMyAdmin не меняй!!! $dbPassword = 'mysql'; // Пароль, если не реестировался на phpMyAdmin не меняй!!! define("URL", "http://super-fizuka.com/"); // Напиши по какому юрл будет открываться твой сайт!!!