Advertisement
Guest User

Untitled

a guest
Feb 1st, 2016
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. <?php
  2.  
  3. if (isset($_POST['submit'])) {
  4.  
  5. $username = $_POST['username'];
  6. $password = $_POST['password'];
  7.  
  8. $connection = mysqli_connect('localhost', 'root', '', 'loginapp');
  9.  
  10. if ($connection) {
  11. echo "Connected";
  12. } else {
  13. die("database failed");
  14. }
  15.  
  16. $query = "INSERT INTO users(username,password)";
  17. $query .= "VALUES ('$username', '$password')";
  18.  
  19. $result = mysqli_query($connection, $query);
  20.  
  21. if (!$result) {
  22. die('query failed' . mysqli_error());
  23. }
  24. }
  25.  
  26. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement