Advertisement
Guest User

Untitled

a guest
Apr 14th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.53 KB | None | 0 0
  1. <?php
  2. $servername = "";
  3. $username = "";
  4. $password = "";
  5. $dbname = "test";
  6.  
  7. $conn = new mysqli($servername, $username, $password, $dbname);
  8.  
  9. if (!$conn) {
  10.                 die("connection failed: " . mysqli_error());
  11. }
  12.  
  13. $username = $_POST['username'];
  14. $password = $_POST['password'];
  15.  
  16. $sql = "INSERT INTO user (username, password) VALUES ('$username', '$password')";
  17.  
  18.  
  19. if($conn->query($sql) === TRUE) {
  20.         echo "created new account";
  21. } else {
  22.         echo "Error";
  23. }
  24.         $conn->close();
  25.  
  26. ?>
  27.  
  28.  
  29. ~
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement