0
Hello, I know almost nothing about Php and mysqli. I am trying to implement the user system for the site, the registration is already working but I can register with the same email as many times as you want. How I check if there is already the email registering in the BD?
So far I’ve only got this, Form "index.php" ;
config.php (connects to the database);
controleindex.php (sending the values to the BD table)
<?php
require_once("config.php");
$nome = $_POST['nome'];
$sobre = $_POST['sobre'];
$email = $_POST['email'];
$senha = $_POST['senha'];
$mysqli->query("Insert into usuarios (nome,sobre,email,senha) values ('".$nome."','".$sobre."','".$email."','".$senha."')")
?>
Wow, thank you so much!! just one more question, how can I put the message as a warning or something? I use $Row to do this?
– Éo Ronaldo Dll
Then it depends on the flow you will use, you can redirect the user to the same page of the registration setting in the session or passing through the url a value to inform that the email has already been registered. Ex:
http://houseofcoin.com/pt/?msg=emailcadastro
then you check whether the$_GET['msg']
was set and display the message according to this value. Or even (an elegant solution), give aalert
kind of:"echo <script>alert('E-mail já cadastrado!')</script>"
and redirect to the registration page.– fernandoandrade
@It’s oronaldodll just out of curiosity, I noticed that you accepted and dismissed this answer. There is something worth correcting/commenting on or missing in the answer?
– Sergio
@Sergio I’m just validating the answer that fits the most problem, for in the future other users can benefit from it.
– Éo Ronaldo Dll
@That’s why the choice is yours, always. I was just curious because others voted for her and had not left comment for the author to realize what failed or what may be missing.
– Sergio
@Sergio really, it was a mistake on my part...
– Éo Ronaldo Dll