Advertisement
Guest User

Untitled

a guest
Nov 1st, 2018
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. <?php
  2. //connection
  3.  
  4.  
  5. include("connection.php");
  6.  
  7. //prepare statement
  8. $sql = "insert into users(username,email,password) values(?,?,?)";
  9.  
  10. $stmt = $conn->prepare($sql);
  11.  
  12. //bind parameters
  13.  
  14.  
  15. $stmt->bind_param("sss", $username, $email, $password);
  16.  
  17. //set parameters
  18.  
  19. $username=$_POST["username"];
  20. $email=$_POST["email"];
  21. $password=$_POST["password"];
  22.  
  23.  
  24. //execute
  25.  
  26. $stmt->execute();
  27.  
  28. echo "new user added successfully";
  29.  
  30.  
  31. //redirect
  32.  
  33. header("Location: index.html");
  34. //close stmt connection
  35.  
  36. $stmt->close();
  37.  
  38. $conn->close();
  39.  
  40.  
  41.  
  42.  
  43.  
  44. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement