Guest User

Untitled

a guest
Jan 3rd, 2018
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.76 KB | None | 0 0
  1. <?php
  2.  
  3. $host = "localhost";
  4. $user = "root";
  5. $pass = "";
  6. $banco ="cadastro";
  7.  
  8.  
  9. // Criando a conexão
  10. $conexao = new mysqli($host, $user, $pass, $banco);
  11.  
  12. // checando a conexão
  13. if ($conexao->connect_error) {
  14.     die("Conexão Falhou: " . $conexao->connect_error);
  15. }
  16.  
  17. $login = $_POST['login'];
  18. $email = $_POST['email'];
  19. $senha = $_POST['senha'];
  20. $senhaconf = $_POST['senhaconf'];
  21. $pais = $_POST['pais'];
  22. $telefone = $_POST['telefone'];
  23.  
  24. $sql = "INSERT INTO usuarios ('login', 'senha', 'email','senha','pais','telefone')
  25. VALUES ($login, $email , $senha, $senhaconf, $pais ,$telefone )";
  26.  
  27. if ($conexao->query($sql) === TRUE) {
  28.     echo "Inserido com sucesso";
  29. } else {
  30.     echo "Erro: " . $sql . "<br>" . $conexao->error;
  31. }
  32.  
  33. $conexao->close();
  34.  
  35. ?>
Advertisement
Add Comment
Please, Sign In to add comment