Advertisement
Guest User

Untitled

a guest
Mar 13th, 2017
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. <?php
  2. $url = "localhost";
  3. $user = "root";
  4. $password = "blabla";
  5. $database = "mydb";
  6.  
  7. $conexao = myslqi_connect($url,$user,$password,$database);
  8. if(!$conexao){
  9. echo "Error, nao conectado ao banco de dados".PHP_EOL;
  10. echo "Debugging errno".mysqli_connect_errno().PHP_EOL;
  11. exit;
  12.  
  13. }
  14. ?>
  15.  
  16. <?php
  17. if(isset($_GET['submit'])){
  18. $nome = $_GET['nome'];
  19. $email = $_GET['email'];
  20. $senha = $_GET['senha'];
  21. $confirmarsenha = $_GET['confirmarsenha'];
  22. $sql = "INSERT INTO `produto`( `nome`, `email`, `senha`, `confirmarsenha`) VALUES ('".$nome."', '".$email."', '".$senha."', '".$confirmarsenha."')";
  23. if( mysqli_query($conexao,$sql)){
  24.  
  25. echo "<script> alert('Cadastro realizado com sucesso') </script>";
  26.  
  27. }//salvando no banco de dados
  28.  
  29. mysqli_close($conexao);//comando para fechar conexao
  30. }
  31. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement