Answer the question
In order to leave comments, you need to log in
How to check records in database?
There is a code that, in my case, writes to the session and all this is sent to the database. But when I enter the same records, he says nothing. How do I make sure that when a record matches, the user is told that such a record exists?
<?php
require_once('db.php');
if(isset($_POST['button'])){
$login = $_POST['login'];
$password = $_POST['password'];
$rpassword = $_POST['r-password'];
$email = $_POST['email'];
}
if($password){
echo 'Регистрация прошла успешна';
mysql_query("INSERT INTO users(login, password, email) VALUES('$login', '$password', '$email')");
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Регистрация</title>
<meta charset="utf-8">
</head>
<body>
<form action='az.php' method="post">
<br>
<input type="text" name="login" required placeholder="Дата">
<br>
<input type="text" name="password" required placeholder="ФИО">
<br>
<input type="text" name="email" required placeholder="E-mail"><br>
<input type="submit" name="button" value='Регистрация на сеанс'>
</form>
</body>
</html>
Answer the question
In order to leave comments, you need to log in
Before writing to the database, pull out the contents of this table and compare (by what field you have there - I don't know) whether there is a record with such a value in the database. If not - add, if there is - then look at the situation according to the situation, what you need
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question