The connection to the DB was successfully established. If I play the same Query in PhpMyAdmmin the command works and the data is saved in the DB. But if I use the same command in PHP it just does not save in the DB.
Index.php file below:
<form action="cadastro.php" method="post" name="signup">
<div>
<label for="name">Nome: </label>
<input type="text" id="name" name="nome" />
</div>
<div>
<label for="email">E-mail: </label>
<input type="email" id="email" name="email" />
</div>
<div>
<label for="senha">Senha: </label>
<input type="password" id="senha" name="senha" />
</div>
<div class="button">
<button type="submit">Cadastrar!</button>
</div>
</form>
Archive cadastro.php below:
<?php
//conecta com o banco de dados MySQL
$DB_HOST = "localhost";
$DB_USUARIO = "root";
$BD_SENHA = "";
$DB_BANCO = "crud";
$db = mysqli_connect($DB_HOST, $DB_USUARIO, '', $DB_BANCO) or die(mysqli_errno());
?>
<?php
//resgata o que foi mandado pelo usuario
$nome = $_POST ['nome'];
$email = $_POST['email'];
$senha = $_POST['senha'];
//funcao para gravar os dados no banco de dados
$sql = "INSERT INTO user(userNome, userEmail, userSenha) VALUES ($nome, $email, $senha)";
echo "<h1>CADASTRADO COM SUCESSO</h1>";
?>
I was able to learn the concepts of PHP well, but spent all day packing this part of making the connection between the source code and MySQL. Thanks in advance for your help.