Good day!
There is a code
<!DOCTYPE html> <html> <head> <?php $title = "Сайт гильдии"; require_once "blocks/head.php" ?> </head> <body> <?php require_once "blocks/header.php" ?> <div id="wrapper"> <div id="leftCol"> <div> <?php if (isset($_POST['nik']) && isset($_POST['class']) && isset($_POST['type']) && isset($_POST['part']) && isset($_POST['hole']) && isset($_POST['zatocka']) && isset($_POST['summ']) && isset($_POST['log']) && isset($_POST['pass'])) { $nik = $_POST['nik']; $class = $_POST['class']; $type = $_POST['type']; $part = $_POST['part']; $hole = $_POST['hole']; $zatocka = $_POST['zatocka']; $summ = $_POST['summ']; $log = $_POST['log']; $pass = $_POST['pass']; $con = mysqli_connect("127.0.0.1", "$log", "$pass", "rf", "3306"); mysqli_set_charset($con, "utf8"); if (mysqli_connect_errno()) { exit ("Вы ввели неправильный Логин и/или пароль"); echo "провал" . mysqli_connect_error(); } $query1 = "INSERT INTO `sklad` (nik, class, type, part, hole, zatocka, summ) VALUES ('$nik', '$class', '$type', '$part', '$hole', '$zatocka', '$summ');"; $result1 = mysqli_query($con, $query1); if ($result1 = 'true') { echo '<h3 style="color:#ff0000">Информация занесена в базу данных</h3>' . "<br>"; } else { echo "Информация не занесена в базу данных"; } $query = "SELECT * FROM sklad;"; //выбрать все записи из таблицы nickname $result = mysqli_query($con, $query); ... and the usual HTML form that the user fills out on the PHP page and which sends global variables to this code / file, including the last ones: the login and password to the MySQL database. If the user enters the correct data in advance, including the login / password, then there are no problems, everything is added to the database. But if the user has entered incorrect login and / or password, then errors from the top are displayed, like:
Warning: mysqli_connect (): (HY000 / 1044): Access denied for user '' @ 'localhost' to database 'rf' in C: \ wamp64 \ www \ site \ bd2.php on line 34
Warning: mysqli_set_charset () expects parameter 1 to be mysqli, boolean given in C: \ wamp64 \ www \ site \ bd2.php on line 35
The question is: how to remove these errors and leave only the phrase that immediately goes after these errors.
You entered an incorrect username and / or password
PS I'm new. Many technologies are not familiar to me.