Cookies are not added?

Hi folks, finally completed the registration, make an entry. Appeared this error - cookies are not added.59cfb752944ed512700422.png

$dbc = mysqli_connect('Test', 'root', ", 'registr');
$user_username = htmlspecialchars(trim($_POST['username']));
$user_password = htmlspecialchars(($_POST['password']));
if(!empty($user_username) && !empty($user_password)){
$query = "SELECT `user_id`, `user_name` FROM `registr` WHERE user_name = '$user_username' AND password = SHA('$user_password')";
$data = mysqli_query($dbc, $query);
if(mysqli_num_rows($data) == 1){
$row = mysqli_fetch_assoc($data);
setcookie('user_id', $row['user_id'], time()+(60*60*24*30));
setcookie('user_name', $row['user_name'], time()+(60*60*24*30));
echo "All ok";
echo "Wrong username or password";


Enter username
Enter password

echo "You registr";
June 14th 19 at 21:04
2 answers
June 14th 19 at 21:06
some chaotic code as you do it read with that formatting))) check cookies are not terms, but just their reading. if read - so everything is in order. and conditions long and tangled...
June 14th 19 at 21:08
You again with the same code and usually not decorated.
Again, you didn't check the code with the debugger.
You should not engage in programming, the last 4 topics are almost same and you have never used the tips. This suggests that you don't want to learn.
You even hard to press the three dots and select php, that would be a user easier to read the code.
Thanks for the reply at least something. - Eldridge53 commented on June 14th 19 at 21:11

Find more questions by tags PHP