T
T
thesirvlad2020-05-23 16:38:22
PHP
thesirvlad, 2020-05-23 16:38:22

What to do if the entrance to the site does not work, although the code seems to be correct?

Hello everyone! The problem is that I can't log in because it doesn't find it in the database and always sends me "0" can you help?

<?php
 session_start();

$connect = mysqli_connect('localhost','root','root','register');

if (!$connect) {
   echo "Ошибка подключения к базе данных.";
} 

   $login = $_POST['login'];
   $password = $_POST['password'];

   $check_user = mysqli_query($connect, "SELECT * FROM `users` WHERE `login` = '$login' AND `password` = '$password'");
   echo mysqli_num_rows($check_user);

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question