1
<?php
$host = "localhost";
$user = "root";
$pass = "";
$db = "tomorrow";
$conexao=@mysqli_connect($host, $user, $pass) or die(mysqli_error());
mysqli_select_db($conexao,$db) or die(mysqli_error());
?>
<?php
$username=$_POST['username'];
$email=$_POST['email'];
$password=$_POST['password'];
$sql=mysqli_query($conexao,"INSERT INTO usuarios(username, email, password)VALUES('$username', '$email', '$password')");
echo "<center><h1>Cadastro realizado com sucesso</h1></center>";
mysqli_close($conexao);
?>
Remove the
@
to check for errors; The functionmysqli_error
after the methodmysqli_connect
is incorrect, the correct ismysqli_connect_errno
; Aftermysqli_query
addmysqli_error
to check whether thequery
is correct; the message is showing because you have not added aif
to check whether thequery
was successfully executed; The functionmysqli_error
precise parameter$conexão
etc..– Valdeir Psr
there is no way to comment with the code to help me more please men
– Felipe Lima
In the database the field is written "emai" and in PHP is "email".
– Diego Vieira
Why don’t you test the query before showing that it was successfully inserted? Use the G-ZUIS love control structures! And why are you using the tag center? Use the brand name too.
– user103257